Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new command Get Powe Platform Connectors. #3309

Merged
merged 4 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added `Add-PnPFlowOwner` and `Remove-PnPFlowOwner` cmdlets which allow granting or removing permissions to a Power Automate flow [#3343](https://github.com/pnp/powershell/pull/3343)
- Added `Get-PnPFlowOwner` cmdlet which allows retrieving the owners of a Power Automate flow [#3314](https://github.com/pnp/powershell/pull/3314)
- Added `-AvailableForTagging` to `Set-PnPTerm` which allows the available for tagging property on a Term to be set [#3321](https://github.com/pnp/powershell/pull/3321)
- Added `Get-PnPPowerPlatformConnector` cmdlet which allows for all custom connectors to be retrieved [#3309](https://github.com/pnp/powershell/pull/3309)

### Fixed

Expand Down
106 changes: 106 additions & 0 deletions documentation/Get-PnPPowerPlatformConnector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
Module Name: PnP.PowerShell
schema: 2.0.0
applicable: SharePoint Online
online version: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerPlatformConnector.html
external help file: PnP.PowerShell.dll-Help.xml
title: Get-PnPPowerPlatformConnector
---

# Get-PnPPowerPlatformConnector

## SYNOPSIS

**Required Permissions**

* Azure: management.azure.com

Returns the Custom Power Platform Connectors for a given environment

## SYNTAX

```powershell
Get-PnPPowerPlatformConnector [-Environment <PowerPlatformEnvironmentPipeBind>] [-Identity <PowerPlatformConnectorPipeBind>] [-AsAdmin] [-Verbose]
```

## DESCRIPTION
This cmdlet returns the custom connectors on a given enviroment.

## EXAMPLES

### Example 1
```powershell
Get-PnPPowerPlatformConnector -Environment (Get-PnPPowerPlatformEnvironment)
```
This returns all the custom connectors for a given Power Platform environment

### Example 2
```powershell
Get-PowerPlatformConnectorPipeBind -Environment (Get-PnPPowerPlatformEnvironment -IsDefault) -Identity fba63225-baf9-4d76-86a1-1b42c917a182
```
This returns a specific custom connector on the default Power Platform environment

## PARAMETERS

### -Environment
The name of the Power Platform environment or an Environment instance to retrieve the available custom connectors for. If omitted, the default environment will be used.

```yaml
Type: PowerPlatformEnvironmentPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: The default environment
Accept pipeline input: True
Accept wildcard characters: False
```

### -Identity
The Id of the connector to retrieve. If not provided, all custom connectors will be returned.

```yaml
Type: PowerPlatformConnectorPipeBind
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AsAdmin
If specified returns all the custom connectors as admin. If not specified only the custom connectors for the current user will be returned.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Verbose
When provided, additional debug statements will be shown while executing the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## RELATED LINKS

[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
26 changes: 26 additions & 0 deletions src/Commands/Base/PipeBinds/PowerPlatformConnectorPipeBind.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace PnP.PowerShell.Commands.Base.PipeBinds
{
public sealed class PowerPlatformConnectorPipeBind
{
private readonly string _name;
private readonly Model.PowerPlatform.Environment.PowerPlatformConnector _connector;
public PowerPlatformConnectorPipeBind(string input)
{
_name = input;
}

public PowerPlatformConnectorPipeBind(Model.PowerPlatform.Environment.PowerPlatformConnector connector)
{
_connector = connector;
}

public string GetName()
{
if (_connector != null)
{
return _connector.Name;
}
return _name;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using PnP.Framework.Extensions;
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnector
{
/// <summary>
/// Name of the connector as its GUID
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// Unique identifier of this connector.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; }
/// <summary>
/// Type of object, typically Microsoft.PowerApps/apis
/// </summary>
[JsonPropertyName("type")]
public string Type { get; set; }
/// <summary>
/// Additional information on the Connector
/// </summary>
[JsonPropertyName("properties")]
public PowerPlatformConnectorProperties Properties { get; set; }
public bool IsCustomConnector
{
get { return Properties.isCustomApi; }
}
public string DisplayName
{
get { return Properties.displayName; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorApiDefinitions
{
[JsonPropertyName("originalSwaggerUrl")]
public string originalSwaggerUrl { get; set; }

[JsonPropertyName("modifiedSwaggerUrl")]
public string modifiedSwaggerUrl { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorAuthorizationUrl
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorBackendService
{
[JsonPropertyName("serviceUrl")]
public string serviceUrl { get; set; }
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorConnectionParameters
{
[JsonPropertyName("token")]
public PowerPlatformConnectorToken token { get; set; }

[JsonPropertyName("token:TenantId")]
public PowerPlatformConnectorTokenTenantId tokenTenantId { get; set; }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorConstraints
{
[JsonPropertyName("required")]
public string required { get; set; }

[JsonPropertyName("hidden")]
public string hidden { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
//{
// public class PowerPlatformConnectorContact
// {
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorCreatedBy
{
[JsonPropertyName("id")]
public string id { get; set; }

[JsonPropertyName("displayName")]
public string displayName { get; set; }

[JsonPropertyName("email")]
public string email { get; set; }

[JsonPropertyName("type")]
public string type { get; set; }

[JsonPropertyName("tenantId")]
public string tenantId { get; set; }

[JsonPropertyName("userPrincipalName")]
public string userPrincipalName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorCustomParameters
{
[JsonPropertyName("loginUri")]
public PowerPlatformConnectorLoginUri loginUri { get; set; }

[JsonPropertyName("tenantId")]
public PowerPlatformConnectorTenantId tenantId { get; set; }

[JsonPropertyName("resourceUri")]
public PowerPlatformConnectorResourceUri resourceUri { get; set; }

[JsonPropertyName("authorizationUrl")]
public PowerPlatformConnectorAuthorizationUrl authorizationUrl { get; set; }

[JsonPropertyName("tokenUrl")]
public PowerPlatformConnectorTokenUrl tokenUrl { get; set; }

[JsonPropertyName("refreshUrl")]
public PowerPlatformConnectorRefreshUrl refreshUrl { get; set; }

[JsonPropertyName("enableOnbehalfOfLogin")]
public PowerPlatformConnectorEnableOnbehalfOfLogin enableOnbehalfOfLogin { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorEnableOnbehalfOfLogin
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorEnvironment
{
[JsonPropertyName("id")]
public string id { get; set; }

[JsonPropertyName("name")]
public string name { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
//{
// public class PowerPlatformConnectorLicense
// {
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace PnP.PowerShell.Commands.Model.PowerPlatform.Environment
{
public class PowerPlatformConnectorLoginUri
{
[JsonPropertyName("value")]
public string value { get; set; }
}
}
Loading