From 5a7c25d71ad033839709207a1c8777acf3db3ba9 Mon Sep 17 00:00:00 2001 From: Siddharth Vaghasia Date: Thu, 9 Feb 2023 01:50:05 +0530 Subject: [PATCH 1/4] Added new command Get-PnPPowerApp to get PowerApps from a given environment --- documentation/Get-PnPPowerApp.md | 113 ++++ .../Base/PipeBinds/PowerAppPipeBind.cs | 26 + .../Model/PowerPlatform/PowerApp/PowerApp.cs | 41 ++ .../PowerApp/PowerAppProperties.cs | 510 ++++++++++++++++++ .../PowerPlatform/PowerApps/GetPowerApp.cs | 47 ++ 5 files changed, 737 insertions(+) create mode 100644 documentation/Get-PnPPowerApp.md create mode 100644 src/Commands/Base/PipeBinds/PowerAppPipeBind.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs create mode 100644 src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs diff --git a/documentation/Get-PnPPowerApp.md b/documentation/Get-PnPPowerApp.md new file mode 100644 index 000000000..ea23fcf37 --- /dev/null +++ b/documentation/Get-PnPPowerApp.md @@ -0,0 +1,113 @@ +--- +Module Name: PnP.PowerShell +schema: 2.0.0 +applicable: SharePoint Online +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerApp.html +external help file: PnP.PowerShell.dll-Help.xml +title: Get-PnPPowerApp +--- + +# Get-PnPPowerApp + +## SYNOPSIS + +**Required Permissions** + +* Azure: management.azure.com + +Returns the Power Apps for a given environment + +## SYNTAX + +```powershell +Get-PnPPowerApp -Environment [-AsAdmin] [-Identity ] +[-Connection ] [] +``` + +## DESCRIPTION +This cmdlet returns the Power Apps for a given enviroment. + +## EXAMPLES + +### Example 1 +```powershell +$environment = Get-PnPPowerPlatformEnvironment +Get-PnPPowerApp -Environment $environment +``` +This returns all the apps for a given Power Platform environment + +### Example 2 +```powershell +$environment = Get-PnPPowerPlatformEnvironment +Get-PnPPowerApp -Environment $environment -Identity fba63225-baf9-4d76-86a1-1b42c917a182 +``` +This returns a specific app + +## PARAMETERS + +### -Environment +The name of the Power Platform environment or an Environment object to retrieve the available Power Apps for. + +```yaml +Type: PowerPlatformEnvironmentPipeBind +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identity +The Id of the app to retrieve. + +```yaml +Type: PowerAppPipeBind +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 Power Apps as admin. If not specified only the apps 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 +``` + +### -Connection +Optional connection to be used by the cmdlet. +Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection. + +```yaml +Type: PnPConnection +Parameter Sets: (All) +Aliases: + +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) + + diff --git a/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs b/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs new file mode 100644 index 000000000..8735b3e0d --- /dev/null +++ b/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs @@ -0,0 +1,26 @@ +namespace PnP.PowerShell.Commands.Base.PipeBinds +{ + public sealed class PowerAppPipeBind + { + private readonly string _name; + private readonly Model.PowerPlatform.PowerApp.PowerApp _powerapp; + public PowerAppPipeBind(string input) + { + _name = input; + } + + public PowerAppPipeBind(Model.PowerPlatform.PowerApp.PowerApp powerapp) + { + _powerapp = powerapp; + } + + public string GetName() + { + if (_powerapp != null) + { + return _powerapp.name; + } + return _name; + } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs new file mode 100644 index 000000000..339adf3af --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs @@ -0,0 +1,41 @@ +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + /// + /// Contains information on one Microsoft Power Apps App + /// + public class PowerApp + { + /// + /// Name of the app as its GUID + /// + public string name { get; set; } + /// + /// Unique identifier of this app. Use instead to see the friendly name of the app as shown through apps.powerapps.com. + /// + public string id { get; set; } + /// + /// Type of object, typically Microsoft.PowerApps/apps + /// + public string type { get; set; } + public Tags tags { get; set; } + /// + /// Additional information on the App + /// + [JsonPropertyName("properties")] + public PowerAppProperties properties { get; set; } + /// + /// Location of the app + /// + public string appLocation { get; set; } + /// + /// Flag if the app is component library or normal app + /// + public bool isAppComponentLibrary { get; set; } + /// + /// Type of App - CanvasClassicApp/AppComponentLibrary + /// + public string appType { get; set; } + } +} \ No newline at end of file diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs new file mode 100644 index 000000000..0e3382193 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs @@ -0,0 +1,510 @@ +using System.Text.Json.Serialization; +using System; +using System.Collections.Generic; +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public class PowerAppProperties + { + [JsonPropertyName("appVersion")] + public DateTimeOffset AppVersion { get; set; } + + [JsonPropertyName("createdByClientVersion")] + public ClientVersion CreatedByClientVersion { get; set; } + + [JsonPropertyName("minClientVersion")] + public ClientVersion MinClientVersion { get; set; } + + [JsonPropertyName("owner")] + public CreatedBy Owner { get; set; } + + [JsonPropertyName("createdBy")] + public CreatedBy CreatedBy { get; set; } + + [JsonPropertyName("lastModifiedBy")] + public CreatedBy LastModifiedBy { get; set; } + + [JsonPropertyName("backgroundColor")] + public string BackgroundColor { get; set; } + + [JsonPropertyName("backgroundImageUri")] + public Uri BackgroundImageUri { get; set; } + + [JsonPropertyName("teamsColorIconUrl")] + public Uri TeamsColorIconUrl { get; set; } + + [JsonPropertyName("teamsOutlineIconUrl")] + public Uri TeamsOutlineIconUrl { get; set; } + + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } + + [JsonPropertyName("description")] + public string Description { get; set; } + + [JsonPropertyName("appUris")] + public AppUris AppUris { get; set; } + + [JsonPropertyName("createdTime")] + public DateTimeOffset CreatedTime { get; set; } + + [JsonPropertyName("lastModifiedTime")] + public DateTimeOffset LastModifiedTime { get; set; } + + [JsonPropertyName("sharedGroupsCount")] + public long SharedGroupsCount { get; set; } + + [JsonPropertyName("sharedUsersCount")] + public long SharedUsersCount { get; set; } + + [JsonPropertyName("appOpenProtocolUri")] + public string AppOpenProtocolUri { get; set; } + + [JsonPropertyName("appOpenUri")] + public Uri AppOpenUri { get; set; } + + [JsonPropertyName("appPlayUri")] + public Uri AppPlayUri { get; set; } + + [JsonPropertyName("appPlayEmbeddedUri")] + public Uri AppPlayEmbeddedUri { get; set; } + + [JsonPropertyName("appPlayTeamsUri")] + public string AppPlayTeamsUri { get; set; } + + [JsonPropertyName("connectionReferences")] + public System.Collections.Generic.Dictionary ConnectionReferences { get; set; } + + [JsonPropertyName("userAppMetadata")] + public UserAppMetadata UserAppMetadata { get; set; } + + [JsonPropertyName("isFeaturedApp")] + public bool? IsFeaturedApp { get; set; } + + [JsonPropertyName("bypassConsent")] + public bool? BypassConsent { get; set; } + + [JsonPropertyName("isHeroApp")] + public bool? IsHeroApp { get; set; } + + [JsonPropertyName("environment")] + public Environment Environment { get; set; } + + [JsonPropertyName("almMode")] + public string AlmMode { get; set; } + + [JsonPropertyName("performanceOptimizationEnabled")] + public bool? PerformanceOptimizationEnabled { get; set; } + + [JsonPropertyName("unauthenticatedWebPackageHint")] + public Guid? UnauthenticatedWebPackageHint { get; set; } + + [JsonPropertyName("canConsumeAppPass")] + public bool? CanConsumeAppPass { get; set; } + + [JsonPropertyName("enableModernRuntimeMode")] + public bool? EnableModernRuntimeMode { get; set; } + + [JsonPropertyName("executionRestrictions")] + public ExecutionRestrictions ExecutionRestrictions { get; set; } + + [JsonPropertyName("appPlanClassification")] + public string AppPlanClassification { get; set; } + + [JsonPropertyName("usesPremiumApi")] + public bool? UsesPremiumApi { get; set; } + + [JsonPropertyName("usesOnlyGrandfatheredPremiumApis")] + public bool? UsesOnlyGrandfatheredPremiumApis { get; set; } + + [JsonPropertyName("usesCustomApi")] + public bool? UsesCustomApi { get; set; } + + [JsonPropertyName("usesOnPremiseGateway")] + public bool? UsesOnPremiseGateway { get; set; } + + [JsonPropertyName("usesPcfExternalServiceUsage")] + public bool? UsesPcfExternalServiceUsage { get; set; } + + [JsonPropertyName("isCustomizable")] + public bool? IsCustomizable { get; set; } + + [JsonPropertyName("embeddedApp")] + public EmbeddedApp EmbeddedApp { get; set; } + + [JsonPropertyName("publisher")] + public string Publisher { get; set; } + + [JsonPropertyName("databaseReferences")] + public DatabaseReferences DatabaseReferences { get; set; } + + [JsonPropertyName("authorizationReferences")] + public AuthorizationReference[] AuthorizationReferences { get; set; } + } + + public partial class AppUris + { + [JsonPropertyName("documentUri")] + public DocumentUri DocumentUri { get; set; } + + [JsonPropertyName("imageUris")] + public object[] ImageUris { get; set; } + + [JsonPropertyName("additionalUris")] + public object[] AdditionalUris { get; set; } + } + + public partial class DocumentUri + { + [JsonPropertyName("value")] + public Uri Value { get; set; } + + [JsonPropertyName("readonlyValue")] + public Uri ReadonlyValue { get; set; } + } + + public partial class AuthorizationReference + { + [JsonPropertyName("resourceId")] + public string ResourceId { get; set; } + } + + public partial class ConnectionReference + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } + + [JsonPropertyName("iconUri")] + public Uri IconUri { get; set; } + + [JsonPropertyName("dataSources")] + public string[] DataSources { get; set; } + + [JsonPropertyName("dependencies")] + public Guid[] Dependencies { get; set; } + + [JsonPropertyName("dependents")] + public Guid[] Dependents { get; set; } + + [JsonPropertyName("isOnPremiseConnection")] + public bool? IsOnPremiseConnection { get; set; } + + [JsonPropertyName("bypassConsent")] + public bool? BypassConsent { get; set; } + + [JsonPropertyName("apiTier")] + public string ApiTier { get; set; } + + [JsonPropertyName("isCustomApiConnection")] + public bool? IsCustomApiConnection { get; set; } + + [JsonPropertyName("actions")] + public string[] Actions { get; set; } + + [JsonPropertyName("nestedActions")] + public NestedAction[] NestedActions { get; set; } + + [JsonPropertyName("gatewayObjectIdHint")] + public Guid? GatewayObjectIdHint { get; set; } + + [JsonPropertyName("sharedConnectionId")] + public string SharedConnectionId { get; set; } + + [JsonPropertyName("authenticationType")] + public string AuthenticationType { get; set; } + + [JsonPropertyName("endpoints")] + public string[] Endpoints { get; set; } + + + } + + public partial class NestedAction + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("apiName")] + public string ApiName { get; set; } + + [JsonPropertyName("actionName")] + public string ActionName { get; set; } + + [JsonPropertyName("referencedResources")] + public ReferencedResource[] ReferencedResources { get; set; } + } + + public partial class ReferencedResource + { + [JsonPropertyName("key")] + public string Key { get; set; } + + [JsonPropertyName("value")] + public string Value { get; set; } + } + + public partial class CreatedBy + { + [JsonPropertyName("id")] + public Guid 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 Guid TenantId { get; set; } + + [JsonPropertyName("userPrincipalName")] + public string UserPrincipalName { get; set; } + } + + public partial class ClientVersion + { + [JsonPropertyName("major")] + public long Major { get; set; } + + [JsonPropertyName("minor")] + public long Minor { get; set; } + + [JsonPropertyName("build")] + public long Build { get; set; } + + [JsonPropertyName("revision")] + public long Revision { get; set; } + + [JsonPropertyName("majorRevision")] + public long MajorRevision { get; set; } + + [JsonPropertyName("minorRevision")] + public long MinorRevision { get; set; } + } + + public partial class DatabaseReferences + { + [JsonPropertyName("default.cds")] + public DefaultCds DefaultCds { get; set; } + } + + public partial class DefaultCds + { + [JsonPropertyName("databaseDetails")] + public DatabaseDetails DatabaseDetails { get; set; } + + [JsonPropertyName("dataSources")] + public System.Collections.Generic.Dictionary DataSources { get; set; } + + [JsonPropertyName("actions")] + public string[] Actions { get; set; } + } + + public partial class DataSource + { + [JsonPropertyName("entitySetName")] + public string EntitySetName { get; set; } + + [JsonPropertyName("logicalName")] + public string LogicalName { get; set; } + } + + public partial class DatabaseDetails + { + [JsonPropertyName("referenceType")] + public string ReferenceType { get; set; } + + [JsonPropertyName("environmentName")] + public string EnvironmentName { get; set; } + + [JsonPropertyName("linkedEnvironmentMetadata")] + public LinkedEnvironmentMetadata LinkedEnvironmentMetadata { get; set; } + + [JsonPropertyName("overrideValues")] + public OverrideValues OverrideValues { get; set; } + } + + public partial class LinkedEnvironmentMetadata + { + [JsonPropertyName("resourceId")] + public Guid ResourceId { get; set; } + + [JsonPropertyName("friendlyName")] + public string FriendlyName { get; set; } + + [JsonPropertyName("uniqueName")] + public string UniqueName { get; set; } + + [JsonPropertyName("domainName")] + public string DomainName { get; set; } + + [JsonPropertyName("version")] + public Version Version { get; set; } + + [JsonPropertyName("instanceUrl")] + public Uri InstanceUrl { get; set; } + + [JsonPropertyName("instanceApiUrl")] + public Uri InstanceApiUrl { get; set; } + + [JsonPropertyName("baseLanguage")] + public long BaseLanguage { get; set; } + + [JsonPropertyName("instanceState")] + public string InstanceState { get; set; } + + [JsonPropertyName("createdTime")] + public DateTimeOffset CreatedTime { get; set; } + + [JsonPropertyName("platformSku")] + public string PlatformSku { get; set; } + } + + public partial class OverrideValues + { + [JsonPropertyName("status")] + public string Status { get; set; } + } + + public partial class EmbeddedApp + { + [JsonPropertyName("siteId")] + public Uri SiteId { get; set; } + + [JsonPropertyName("listId")] + public Guid ListId { get; set; } + + [JsonPropertyName("listUrl")] + public Uri ListUrl { get; set; } + + [JsonPropertyName("type")] + public string Type { get; set; } + + [JsonPropertyName("screenWidth")] + public long ScreenWidth { get; set; } + + [JsonPropertyName("screenHeight")] + public long ScreenHeight { get; set; } + } + + public partial class Environment + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("location")] + public string Location { get; set; } + } + + public partial class ExecutionRestrictions + { + [JsonPropertyName("isTeamsOnly")] + public bool? IsTeamsOnly { get; set; } + + [JsonPropertyName("dataLossPreventionEvaluationResult")] + public DataLossPreventionEvaluationResult DataLossPreventionEvaluationResult { get; set; } + + [JsonPropertyName("httpActionRestriction")] + public HttpActionRestriction HttpActionRestriction { get; set; } + } + + public partial class DataLossPreventionEvaluationResult + { + [JsonPropertyName("status")] + public string Status { get; set; } + + [JsonPropertyName("lastEvaluationDate")] + public DateTimeOffset LastEvaluationDate { get; set; } + + [JsonPropertyName("violationDetails")] + public object[] ViolationDetails { get; set; } + + [JsonPropertyName("violations")] + public object[] Violations { get; set; } + + [JsonPropertyName("violationsByPolicy")] + public object[] ViolationsByPolicy { get; set; } + + [JsonPropertyName("violationErrorMessage")] + public string ViolationErrorMessage { get; set; } + } + + public partial class HttpActionRestriction + { + [JsonPropertyName("appUsesSharepointHttpAction")] + public bool? AppUsesSharepointHttpAction { get; set; } + + [JsonPropertyName("enforcementStrategy")] + public string EnforcementStrategy { get; set; } + + [JsonPropertyName("evaluationTime")] + public DateTimeOffset EvaluationTime { get; set; } + } + + public partial class UserAppMetadata + { + [JsonPropertyName("favorite")] + public string Favorite { get; set; } + + [JsonPropertyName("includeInAppsList")] + public bool? IncludeInAppsList { get; set; } + } + + public partial class Tags + { + [JsonPropertyName("primaryDeviceWidth")] + public string PrimaryDeviceWidth { get; set; } + + [JsonPropertyName("primaryDeviceHeight")] + public string PrimaryDeviceHeight { get; set; } + + [JsonPropertyName("sienaVersion")] + public string SienaVersion { get; set; } + + [JsonPropertyName("deviceCapabilities")] + public string DeviceCapabilities { get; set; } + + [JsonPropertyName("supportsPortrait")] + public string SupportsPortrait { get; set; } + + [JsonPropertyName("supportsLandscape")] + public string SupportsLandscape { get; set; } + + [JsonPropertyName("primaryFormFactor")] + public string PrimaryFormFactor { get; set; } + + [JsonPropertyName("publisherVersion")] + public string PublisherVersion { get; set; } + + [JsonPropertyName("minimumRequiredApiVersion")] + public string MinimumRequiredApiVersion { get; set; } + + [JsonPropertyName("hasComponent")] + public string HasComponent { get; set; } + + [JsonPropertyName("hasUnlockedComponent")] + public string HasUnlockedComponent { get; set; } + + [JsonPropertyName("isUnifiedRootApp")] + public string IsUnifiedRootApp { get; set; } + + [JsonPropertyName("sp-site-id")] + public Uri SpSiteId { get; set; } + + [JsonPropertyName("sp-list-id")] + public Guid? SpListId { get; set; } + } + +} diff --git a/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs b/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs new file mode 100644 index 000000000..bda237b5f --- /dev/null +++ b/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs @@ -0,0 +1,47 @@ +using PnP.PowerShell.Commands.Attributes; +using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base.PipeBinds; +using PnP.PowerShell.Commands.Utilities.REST; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Management.Automation; + + +namespace PnP.PowerShell.Commands.PowerPlatform.PowerApps +{ + [Cmdlet(VerbsCommon.Get, "PnPPowerApp")] + [RequiredMinimalApiPermissions("https://management.azure.com/.default")] + public class GetPowerApp : PnPGraphCmdlet + { + + [Parameter(Mandatory = true)] + public PowerPlatformEnvironmentPipeBind Environment; + + [Parameter(Mandatory = false)] + public SwitchParameter AsAdmin; + + [Parameter(Mandatory = false)] + public PowerAppPipeBind Identity; + + protected override void ExecuteCmdlet() + { + var environmentName = Environment.GetName(); + + if (ParameterSpecified(nameof(Identity))) + { + var appName = Identity.GetName(); + var result = GraphHelper.GetAsync(Connection, $"https://api.powerapps.com/providers/Microsoft.PowerApps{(AsAdmin ? "/scopes/admin/environments/" + environmentName : "")}/apps/{appName}?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); + + WriteObject(result, false); + } + else + { + var apps = GraphHelper.GetResultCollectionAsync(Connection, $"https://api.powerapps.com/providers/Microsoft.PowerApps/apps?api-version=2016-11-01&$filter=environment eq '{environmentName}'", AccessToken).GetAwaiter().GetResult(); + WriteObject(apps, true); + } + } + + } +} From 450f39d1206b26cbb3c0607c2d4eb42e9b602598 Mon Sep 17 00:00:00 2001 From: Siddharth Vaghasia Date: Fri, 17 Mar 2023 09:56:32 +0530 Subject: [PATCH 2/4] Updated the code as per feedback to seperate each entity in seperate file. --- .../Base/PipeBinds/PowerAppPipeBind.cs | 2 +- .../Model/PowerPlatform/PowerApp/PowerApp.cs | 16 +- .../PowerAppAuthorizationReference.cs | 15 + .../PowerApp/PowerAppClientVersion.cs | 29 ++ .../PowerApp/PowerAppConnectionReference.cs | 62 +++ .../PowerApp/PowerAppCreatedBy.cs | 30 ++ ...erAppDataLossPreventionEvaluationResult.cs | 30 ++ .../PowerApp/PowerAppDataSource.cs | 18 + .../PowerApp/PowerAppDatabaseDetails.cs | 24 ++ .../PowerApp/PowerAppDatabaseReferences.cs | 15 + .../PowerApp/PowerAppDefaultCds.cs | 20 + .../PowerApp/PowerAppDocumentUri.cs | 18 + .../PowerApp/PowerAppEmbeddedApp.cs | 31 ++ .../PowerApp/PowerAppEnvironment.cs | 22 + .../PowerApp/PowerAppExecutionRestrictions.cs | 22 + .../PowerApp/PowerAppHttpActionRestriction.cs | 21 + .../PowerAppLinkedEnvironmentMetadata.cs | 45 ++ .../PowerApp/PowerAppNestedAction.cs | 24 ++ .../PowerApp/PowerAppOverrideValues.cs | 16 + .../PowerApp/PowerAppProperties.cs | 389 +----------------- .../PowerApp/PowerAppReferencedResource.cs | 17 + .../PowerPlatform/PowerApp/PowerAppTags.cs | 55 +++ .../PowerPlatform/PowerApp/PowerAppUris.cs | 21 + .../PowerApp/PowerAppUserAppMetadata.cs | 17 + 24 files changed, 574 insertions(+), 385 deletions(-) create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppAuthorizationReference.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppClientVersion.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppConnectionReference.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppCreatedBy.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataLossPreventionEvaluationResult.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataSource.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseDetails.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseReferences.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDefaultCds.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppDocumentUri.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppEmbeddedApp.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppEnvironment.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppExecutionRestrictions.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppHttpActionRestriction.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppLinkedEnvironmentMetadata.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppNestedAction.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppOverrideValues.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppReferencedResource.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppTags.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppUris.cs create mode 100644 src/Commands/Model/PowerPlatform/PowerApp/PowerAppUserAppMetadata.cs diff --git a/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs b/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs index 8735b3e0d..38ac4df22 100644 --- a/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs +++ b/src/Commands/Base/PipeBinds/PowerAppPipeBind.cs @@ -18,7 +18,7 @@ public string GetName() { if (_powerapp != null) { - return _powerapp.name; + return _powerapp.Name; } return _name; } diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs index 339adf3af..d908e4167 100644 --- a/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerApp.cs @@ -10,32 +10,32 @@ public class PowerApp /// /// Name of the app as its GUID /// - public string name { get; set; } + public string Name { get; set; } /// /// Unique identifier of this app. Use instead to see the friendly name of the app as shown through apps.powerapps.com. /// - public string id { get; set; } + public string Id { get; set; } /// /// Type of object, typically Microsoft.PowerApps/apps /// - public string type { get; set; } - public Tags tags { get; set; } + public string Type { get; set; } + public PowerAppTags Tags { get; set; } /// /// Additional information on the App /// [JsonPropertyName("properties")] - public PowerAppProperties properties { get; set; } + public PowerAppProperties Properties { get; set; } /// /// Location of the app /// - public string appLocation { get; set; } + public string AppLocation { get; set; } /// /// Flag if the app is component library or normal app /// - public bool isAppComponentLibrary { get; set; } + public bool IsAppComponentLibrary { get; set; } /// /// Type of App - CanvasClassicApp/AppComponentLibrary /// - public string appType { get; set; } + public string AppType { get; set; } } } \ No newline at end of file diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppAuthorizationReference.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppAuthorizationReference.cs new file mode 100644 index 000000000..d58471b5c --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppAuthorizationReference.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppAuthorizationReference + { + [JsonPropertyName("resourceId")] + public string ResourceId { get; set; } + } + +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppClientVersion.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppClientVersion.cs new file mode 100644 index 000000000..56081c64f --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppClientVersion.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppClientVersion + { + [JsonPropertyName("major")] + public long Major { get; set; } + + [JsonPropertyName("minor")] + public long Minor { get; set; } + + [JsonPropertyName("build")] + public long Build { get; set; } + + [JsonPropertyName("revision")] + public long Revision { get; set; } + + [JsonPropertyName("majorRevision")] + public long MajorRevision { get; set; } + + [JsonPropertyName("minorRevision")] + public long MinorRevision { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppConnectionReference.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppConnectionReference.cs new file mode 100644 index 000000000..1816803bf --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppConnectionReference.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppConnectionReference + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } + + [JsonPropertyName("iconUri")] + public Uri IconUri { get; set; } + + [JsonPropertyName("dataSources")] + public string[] DataSources { get; set; } + + [JsonPropertyName("dependencies")] + public Guid[] Dependencies { get; set; } + + [JsonPropertyName("dependents")] + public Guid[] Dependents { get; set; } + + [JsonPropertyName("isOnPremiseConnection")] + public bool? IsOnPremiseConnection { get; set; } + + [JsonPropertyName("bypassConsent")] + public bool? BypassConsent { get; set; } + + [JsonPropertyName("apiTier")] + public string ApiTier { get; set; } + + [JsonPropertyName("isCustomApiConnection")] + public bool? IsCustomApiConnection { get; set; } + + [JsonPropertyName("actions")] + public string[] Actions { get; set; } + + [JsonPropertyName("nestedActions")] + public PowerAppNestedAction[] NestedActions { get; set; } + + [JsonPropertyName("gatewayObjectIdHint")] + public Guid? GatewayObjectIdHint { get; set; } + + [JsonPropertyName("sharedConnectionId")] + public string SharedConnectionId { get; set; } + + [JsonPropertyName("authenticationType")] + public string AuthenticationType { get; set; } + + [JsonPropertyName("endpoints")] + public string[] Endpoints { get; set; } + + + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppCreatedBy.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppCreatedBy.cs new file mode 100644 index 000000000..aaa8bbd65 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppCreatedBy.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppCreatedBy + { + [JsonPropertyName("id")] + public Guid 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 Guid TenantId { get; set; } + + [JsonPropertyName("userPrincipalName")] + public string UserPrincipalName { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataLossPreventionEvaluationResult.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataLossPreventionEvaluationResult.cs new file mode 100644 index 000000000..a279e285f --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataLossPreventionEvaluationResult.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppDataLossPreventionEvaluationResult + { + [JsonPropertyName("status")] + public string Status { get; set; } + + [JsonPropertyName("lastEvaluationDate")] + public DateTimeOffset LastEvaluationDate { get; set; } + + [JsonPropertyName("violationDetails")] + public object[] ViolationDetails { get; set; } + + [JsonPropertyName("violations")] + public object[] Violations { get; set; } + + [JsonPropertyName("violationsByPolicy")] + public object[] ViolationsByPolicy { get; set; } + + [JsonPropertyName("violationErrorMessage")] + public string ViolationErrorMessage { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataSource.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataSource.cs new file mode 100644 index 000000000..3216a20aa --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDataSource.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class DataSource + { + [JsonPropertyName("entitySetName")] + public string EntitySetName { get; set; } + + [JsonPropertyName("logicalName")] + public string LogicalName { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseDetails.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseDetails.cs new file mode 100644 index 000000000..7d18da348 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseDetails.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class DatabaseDetails + { + [JsonPropertyName("referenceType")] + public string ReferenceType { get; set; } + + [JsonPropertyName("environmentName")] + public string EnvironmentName { get; set; } + + [JsonPropertyName("linkedEnvironmentMetadata")] + public PowerAppLinkedEnvironmentMetadata LinkedEnvironmentMetadata { get; set; } + + [JsonPropertyName("overrideValues")] + public PowerAppOverrideValues OverrideValues { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseReferences.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseReferences.cs new file mode 100644 index 000000000..c44bda77c --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDatabaseReferences.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class DatabaseReferences + { + [JsonPropertyName("default.cds")] + public PowerAppDefaultCds DefaultCds { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDefaultCds.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDefaultCds.cs new file mode 100644 index 000000000..30b91ae46 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDefaultCds.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppDefaultCds + { + [JsonPropertyName("databaseDetails")] + public DatabaseDetails DatabaseDetails { get; set; } + + [JsonPropertyName("dataSources")] + public System.Collections.Generic.Dictionary DataSources { get; set; } + + [JsonPropertyName("actions")] + public string[] Actions { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDocumentUri.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDocumentUri.cs new file mode 100644 index 000000000..fc498a1fc --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppDocumentUri.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppDocumentUri + { + [JsonPropertyName("value")] + public Uri Value { get; set; } + + [JsonPropertyName("readonlyValue")] + public Uri ReadonlyValue { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEmbeddedApp.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEmbeddedApp.cs new file mode 100644 index 000000000..0a268c9e8 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEmbeddedApp.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppEmbeddedApp + { + [JsonPropertyName("siteId")] + public Uri SiteId { get; set; } + + [JsonPropertyName("listId")] + public Guid ListId { get; set; } + + [JsonPropertyName("listUrl")] + public Uri ListUrl { get; set; } + + [JsonPropertyName("type")] + public string Type { get; set; } + + [JsonPropertyName("screenWidth")] + public long ScreenWidth { get; set; } + + [JsonPropertyName("screenHeight")] + public long ScreenHeight { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEnvironment.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEnvironment.cs new file mode 100644 index 000000000..10da2b30f --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppEnvironment.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppEnvironment + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("location")] + public string Location { get; set; } + } + +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppExecutionRestrictions.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppExecutionRestrictions.cs new file mode 100644 index 000000000..40ef7bdc4 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppExecutionRestrictions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class ExecutionRestrictions + { + [JsonPropertyName("isTeamsOnly")] + public bool? IsTeamsOnly { get; set; } + + [JsonPropertyName("dataLossPreventionEvaluationResult")] + public PowerAppDataLossPreventionEvaluationResult DataLossPreventionEvaluationResult { get; set; } + + [JsonPropertyName("httpActionRestriction")] + public PowerAppHttpActionRestriction HttpActionRestriction { get; set; } + } + +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppHttpActionRestriction.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppHttpActionRestriction.cs new file mode 100644 index 000000000..2a892064c --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppHttpActionRestriction.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppHttpActionRestriction + { + [JsonPropertyName("appUsesSharepointHttpAction")] + public bool? AppUsesSharepointHttpAction { get; set; } + + [JsonPropertyName("enforcementStrategy")] + public string EnforcementStrategy { get; set; } + + [JsonPropertyName("evaluationTime")] + public DateTimeOffset EvaluationTime { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppLinkedEnvironmentMetadata.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppLinkedEnvironmentMetadata.cs new file mode 100644 index 000000000..b96df634f --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppLinkedEnvironmentMetadata.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppLinkedEnvironmentMetadata + { + [JsonPropertyName("resourceId")] + public Guid ResourceId { get; set; } + + [JsonPropertyName("friendlyName")] + public string FriendlyName { get; set; } + + [JsonPropertyName("uniqueName")] + public string UniqueName { get; set; } + + [JsonPropertyName("domainName")] + public string DomainName { get; set; } + + [JsonPropertyName("version")] + public Version Version { get; set; } + + [JsonPropertyName("instanceUrl")] + public Uri InstanceUrl { get; set; } + + [JsonPropertyName("instanceApiUrl")] + public Uri InstanceApiUrl { get; set; } + + [JsonPropertyName("baseLanguage")] + public long BaseLanguage { get; set; } + + [JsonPropertyName("instanceState")] + public string InstanceState { get; set; } + + [JsonPropertyName("createdTime")] + public DateTimeOffset CreatedTime { get; set; } + + [JsonPropertyName("platformSku")] + public string PlatformSku { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppNestedAction.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppNestedAction.cs new file mode 100644 index 000000000..a9f150b39 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppNestedAction.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppNestedAction + { + [JsonPropertyName("id")] + public string Id { get; set; } + + [JsonPropertyName("apiName")] + public string ApiName { get; set; } + + [JsonPropertyName("actionName")] + public string ActionName { get; set; } + + [JsonPropertyName("referencedResources")] + public PowerAppReferencedResource[] ReferencedResources { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppOverrideValues.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppOverrideValues.cs new file mode 100644 index 000000000..bc4138a78 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppOverrideValues.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppOverrideValues + { + [JsonPropertyName("status")] + public string Status { get; set; } + } + +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs index 0e3382193..128a90b48 100644 --- a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppProperties.cs @@ -1,9 +1,9 @@ -using System.Text.Json.Serialization; -using System; +using System; using System.Collections.Generic; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using System.Text.Json.Serialization; namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp { @@ -13,19 +13,19 @@ public class PowerAppProperties public DateTimeOffset AppVersion { get; set; } [JsonPropertyName("createdByClientVersion")] - public ClientVersion CreatedByClientVersion { get; set; } + public PowerAppClientVersion CreatedByClientVersion { get; set; } [JsonPropertyName("minClientVersion")] - public ClientVersion MinClientVersion { get; set; } + public PowerAppClientVersion MinClientVersion { get; set; } [JsonPropertyName("owner")] - public CreatedBy Owner { get; set; } + public PowerAppCreatedBy Owner { get; set; } [JsonPropertyName("createdBy")] - public CreatedBy CreatedBy { get; set; } + public PowerAppCreatedBy CreatedBy { get; set; } [JsonPropertyName("lastModifiedBy")] - public CreatedBy LastModifiedBy { get; set; } + public PowerAppCreatedBy LastModifiedBy { get; set; } [JsonPropertyName("backgroundColor")] public string BackgroundColor { get; set; } @@ -46,7 +46,7 @@ public class PowerAppProperties public string Description { get; set; } [JsonPropertyName("appUris")] - public AppUris AppUris { get; set; } + public PowerAppUris AppUris { get; set; } [JsonPropertyName("createdTime")] public DateTimeOffset CreatedTime { get; set; } @@ -76,10 +76,10 @@ public class PowerAppProperties public string AppPlayTeamsUri { get; set; } [JsonPropertyName("connectionReferences")] - public System.Collections.Generic.Dictionary ConnectionReferences { get; set; } + public System.Collections.Generic.Dictionary ConnectionReferences { get; set; } [JsonPropertyName("userAppMetadata")] - public UserAppMetadata UserAppMetadata { get; set; } + public PowerAppUserAppMetadata UserAppMetadata { get; set; } [JsonPropertyName("isFeaturedApp")] public bool? IsFeaturedApp { get; set; } @@ -91,7 +91,7 @@ public class PowerAppProperties public bool? IsHeroApp { get; set; } [JsonPropertyName("environment")] - public Environment Environment { get; set; } + public PowerAppEnvironment Environment { get; set; } [JsonPropertyName("almMode")] public string AlmMode { get; set; } @@ -133,7 +133,7 @@ public class PowerAppProperties public bool? IsCustomizable { get; set; } [JsonPropertyName("embeddedApp")] - public EmbeddedApp EmbeddedApp { get; set; } + public PowerAppEmbeddedApp EmbeddedApp { get; set; } [JsonPropertyName("publisher")] public string Publisher { get; set; } @@ -142,369 +142,6 @@ public class PowerAppProperties public DatabaseReferences DatabaseReferences { get; set; } [JsonPropertyName("authorizationReferences")] - public AuthorizationReference[] AuthorizationReferences { get; set; } + public PowerAppAuthorizationReference[] AuthorizationReferences { get; set; } } - - public partial class AppUris - { - [JsonPropertyName("documentUri")] - public DocumentUri DocumentUri { get; set; } - - [JsonPropertyName("imageUris")] - public object[] ImageUris { get; set; } - - [JsonPropertyName("additionalUris")] - public object[] AdditionalUris { get; set; } - } - - public partial class DocumentUri - { - [JsonPropertyName("value")] - public Uri Value { get; set; } - - [JsonPropertyName("readonlyValue")] - public Uri ReadonlyValue { get; set; } - } - - public partial class AuthorizationReference - { - [JsonPropertyName("resourceId")] - public string ResourceId { get; set; } - } - - public partial class ConnectionReference - { - [JsonPropertyName("id")] - public string Id { get; set; } - - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } - - [JsonPropertyName("iconUri")] - public Uri IconUri { get; set; } - - [JsonPropertyName("dataSources")] - public string[] DataSources { get; set; } - - [JsonPropertyName("dependencies")] - public Guid[] Dependencies { get; set; } - - [JsonPropertyName("dependents")] - public Guid[] Dependents { get; set; } - - [JsonPropertyName("isOnPremiseConnection")] - public bool? IsOnPremiseConnection { get; set; } - - [JsonPropertyName("bypassConsent")] - public bool? BypassConsent { get; set; } - - [JsonPropertyName("apiTier")] - public string ApiTier { get; set; } - - [JsonPropertyName("isCustomApiConnection")] - public bool? IsCustomApiConnection { get; set; } - - [JsonPropertyName("actions")] - public string[] Actions { get; set; } - - [JsonPropertyName("nestedActions")] - public NestedAction[] NestedActions { get; set; } - - [JsonPropertyName("gatewayObjectIdHint")] - public Guid? GatewayObjectIdHint { get; set; } - - [JsonPropertyName("sharedConnectionId")] - public string SharedConnectionId { get; set; } - - [JsonPropertyName("authenticationType")] - public string AuthenticationType { get; set; } - - [JsonPropertyName("endpoints")] - public string[] Endpoints { get; set; } - - - } - - public partial class NestedAction - { - [JsonPropertyName("id")] - public string Id { get; set; } - - [JsonPropertyName("apiName")] - public string ApiName { get; set; } - - [JsonPropertyName("actionName")] - public string ActionName { get; set; } - - [JsonPropertyName("referencedResources")] - public ReferencedResource[] ReferencedResources { get; set; } - } - - public partial class ReferencedResource - { - [JsonPropertyName("key")] - public string Key { get; set; } - - [JsonPropertyName("value")] - public string Value { get; set; } - } - - public partial class CreatedBy - { - [JsonPropertyName("id")] - public Guid 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 Guid TenantId { get; set; } - - [JsonPropertyName("userPrincipalName")] - public string UserPrincipalName { get; set; } - } - - public partial class ClientVersion - { - [JsonPropertyName("major")] - public long Major { get; set; } - - [JsonPropertyName("minor")] - public long Minor { get; set; } - - [JsonPropertyName("build")] - public long Build { get; set; } - - [JsonPropertyName("revision")] - public long Revision { get; set; } - - [JsonPropertyName("majorRevision")] - public long MajorRevision { get; set; } - - [JsonPropertyName("minorRevision")] - public long MinorRevision { get; set; } - } - - public partial class DatabaseReferences - { - [JsonPropertyName("default.cds")] - public DefaultCds DefaultCds { get; set; } - } - - public partial class DefaultCds - { - [JsonPropertyName("databaseDetails")] - public DatabaseDetails DatabaseDetails { get; set; } - - [JsonPropertyName("dataSources")] - public System.Collections.Generic.Dictionary DataSources { get; set; } - - [JsonPropertyName("actions")] - public string[] Actions { get; set; } - } - - public partial class DataSource - { - [JsonPropertyName("entitySetName")] - public string EntitySetName { get; set; } - - [JsonPropertyName("logicalName")] - public string LogicalName { get; set; } - } - - public partial class DatabaseDetails - { - [JsonPropertyName("referenceType")] - public string ReferenceType { get; set; } - - [JsonPropertyName("environmentName")] - public string EnvironmentName { get; set; } - - [JsonPropertyName("linkedEnvironmentMetadata")] - public LinkedEnvironmentMetadata LinkedEnvironmentMetadata { get; set; } - - [JsonPropertyName("overrideValues")] - public OverrideValues OverrideValues { get; set; } - } - - public partial class LinkedEnvironmentMetadata - { - [JsonPropertyName("resourceId")] - public Guid ResourceId { get; set; } - - [JsonPropertyName("friendlyName")] - public string FriendlyName { get; set; } - - [JsonPropertyName("uniqueName")] - public string UniqueName { get; set; } - - [JsonPropertyName("domainName")] - public string DomainName { get; set; } - - [JsonPropertyName("version")] - public Version Version { get; set; } - - [JsonPropertyName("instanceUrl")] - public Uri InstanceUrl { get; set; } - - [JsonPropertyName("instanceApiUrl")] - public Uri InstanceApiUrl { get; set; } - - [JsonPropertyName("baseLanguage")] - public long BaseLanguage { get; set; } - - [JsonPropertyName("instanceState")] - public string InstanceState { get; set; } - - [JsonPropertyName("createdTime")] - public DateTimeOffset CreatedTime { get; set; } - - [JsonPropertyName("platformSku")] - public string PlatformSku { get; set; } - } - - public partial class OverrideValues - { - [JsonPropertyName("status")] - public string Status { get; set; } - } - - public partial class EmbeddedApp - { - [JsonPropertyName("siteId")] - public Uri SiteId { get; set; } - - [JsonPropertyName("listId")] - public Guid ListId { get; set; } - - [JsonPropertyName("listUrl")] - public Uri ListUrl { get; set; } - - [JsonPropertyName("type")] - public string Type { get; set; } - - [JsonPropertyName("screenWidth")] - public long ScreenWidth { get; set; } - - [JsonPropertyName("screenHeight")] - public long ScreenHeight { get; set; } - } - - public partial class Environment - { - [JsonPropertyName("id")] - public string Id { get; set; } - - [JsonPropertyName("name")] - public string Name { get; set; } - - [JsonPropertyName("location")] - public string Location { get; set; } - } - - public partial class ExecutionRestrictions - { - [JsonPropertyName("isTeamsOnly")] - public bool? IsTeamsOnly { get; set; } - - [JsonPropertyName("dataLossPreventionEvaluationResult")] - public DataLossPreventionEvaluationResult DataLossPreventionEvaluationResult { get; set; } - - [JsonPropertyName("httpActionRestriction")] - public HttpActionRestriction HttpActionRestriction { get; set; } - } - - public partial class DataLossPreventionEvaluationResult - { - [JsonPropertyName("status")] - public string Status { get; set; } - - [JsonPropertyName("lastEvaluationDate")] - public DateTimeOffset LastEvaluationDate { get; set; } - - [JsonPropertyName("violationDetails")] - public object[] ViolationDetails { get; set; } - - [JsonPropertyName("violations")] - public object[] Violations { get; set; } - - [JsonPropertyName("violationsByPolicy")] - public object[] ViolationsByPolicy { get; set; } - - [JsonPropertyName("violationErrorMessage")] - public string ViolationErrorMessage { get; set; } - } - - public partial class HttpActionRestriction - { - [JsonPropertyName("appUsesSharepointHttpAction")] - public bool? AppUsesSharepointHttpAction { get; set; } - - [JsonPropertyName("enforcementStrategy")] - public string EnforcementStrategy { get; set; } - - [JsonPropertyName("evaluationTime")] - public DateTimeOffset EvaluationTime { get; set; } - } - - public partial class UserAppMetadata - { - [JsonPropertyName("favorite")] - public string Favorite { get; set; } - - [JsonPropertyName("includeInAppsList")] - public bool? IncludeInAppsList { get; set; } - } - - public partial class Tags - { - [JsonPropertyName("primaryDeviceWidth")] - public string PrimaryDeviceWidth { get; set; } - - [JsonPropertyName("primaryDeviceHeight")] - public string PrimaryDeviceHeight { get; set; } - - [JsonPropertyName("sienaVersion")] - public string SienaVersion { get; set; } - - [JsonPropertyName("deviceCapabilities")] - public string DeviceCapabilities { get; set; } - - [JsonPropertyName("supportsPortrait")] - public string SupportsPortrait { get; set; } - - [JsonPropertyName("supportsLandscape")] - public string SupportsLandscape { get; set; } - - [JsonPropertyName("primaryFormFactor")] - public string PrimaryFormFactor { get; set; } - - [JsonPropertyName("publisherVersion")] - public string PublisherVersion { get; set; } - - [JsonPropertyName("minimumRequiredApiVersion")] - public string MinimumRequiredApiVersion { get; set; } - - [JsonPropertyName("hasComponent")] - public string HasComponent { get; set; } - - [JsonPropertyName("hasUnlockedComponent")] - public string HasUnlockedComponent { get; set; } - - [JsonPropertyName("isUnifiedRootApp")] - public string IsUnifiedRootApp { get; set; } - - [JsonPropertyName("sp-site-id")] - public Uri SpSiteId { get; set; } - - [JsonPropertyName("sp-list-id")] - public Guid? SpListId { get; set; } - } - } diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppReferencedResource.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppReferencedResource.cs new file mode 100644 index 000000000..4e5f237dd --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppReferencedResource.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppReferencedResource + { + [JsonPropertyName("key")] + public string Key { get; set; } + + [JsonPropertyName("value")] + public string Value { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppTags.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppTags.cs new file mode 100644 index 000000000..d9a2b055e --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppTags.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppTags + { + [JsonPropertyName("primaryDeviceWidth")] + public string PrimaryDeviceWidth { get; set; } + + [JsonPropertyName("primaryDeviceHeight")] + public string PrimaryDeviceHeight { get; set; } + + [JsonPropertyName("sienaVersion")] + public string SienaVersion { get; set; } + + [JsonPropertyName("deviceCapabilities")] + public string DeviceCapabilities { get; set; } + + [JsonPropertyName("supportsPortrait")] + public string SupportsPortrait { get; set; } + + [JsonPropertyName("supportsLandscape")] + public string SupportsLandscape { get; set; } + + [JsonPropertyName("primaryFormFactor")] + public string PrimaryFormFactor { get; set; } + + [JsonPropertyName("publisherVersion")] + public string PublisherVersion { get; set; } + + [JsonPropertyName("minimumRequiredApiVersion")] + public string MinimumRequiredApiVersion { get; set; } + + [JsonPropertyName("hasComponent")] + public string HasComponent { get; set; } + + [JsonPropertyName("hasUnlockedComponent")] + public string HasUnlockedComponent { get; set; } + + [JsonPropertyName("isUnifiedRootApp")] + public string IsUnifiedRootApp { get; set; } + + [JsonPropertyName("sp-site-id")] + public Uri SpSiteId { get; set; } + + [JsonPropertyName("sp-list-id")] + public Guid? SpListId { get; set; } + } +} + diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUris.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUris.cs new file mode 100644 index 000000000..28a170053 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUris.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; + +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public class PowerAppUris + { + [JsonPropertyName("documentUri")] + public PowerAppDocumentUri DocumentUri { get; set; } + + [JsonPropertyName("imageUris")] + public object[] ImageUris { get; set; } + + [JsonPropertyName("additionalUris")] + public object[] AdditionalUris { get; set; } + } +} diff --git a/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUserAppMetadata.cs b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUserAppMetadata.cs new file mode 100644 index 000000000..2a4604bc9 --- /dev/null +++ b/src/Commands/Model/PowerPlatform/PowerApp/PowerAppUserAppMetadata.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json.Serialization; +namespace PnP.PowerShell.Commands.Model.PowerPlatform.PowerApp +{ + public partial class PowerAppUserAppMetadata + { + [JsonPropertyName("favorite")] + public string Favorite { get; set; } + + [JsonPropertyName("includeInAppsList")] + public bool? IncludeInAppsList { get; set; } + } +} From ab8636a622ef76078f5aa19c2d992de7d5b3dad8 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Thu, 23 Mar 2023 17:07:58 +0100 Subject: [PATCH 3/4] Created new PnPAzureManagementApiCmdlet base class to serve all management.azure.com requests to avoid redundant code and stay in line with other cmdlet inherritance, added several options around not requiring an environment to be specified --- CHANGELOG.md | 3 ++ MIGRATE-1.0-to-2.0.md | 1 + documentation/Get-PnPFlow.md | 32 ++++++++---- documentation/Get-PnPPowerApp.md | 26 +++++++--- .../Get-PnPPowerPlatformEnvironment.md | 52 +++++++++++++++++-- src/Commands/Apps/AddApp.cs | 4 -- .../Base/PnPAzureManagementApiCmdlet.cs | 38 ++++++++++++++ src/Commands/Base/PnPGraphCmdlet.cs | 6 +-- .../Base/PnPOfficeManagementApiCmdlet.cs | 2 +- src/Commands/Base/PnPSharePointCmdlet.cs | 2 +- src/Commands/Base/TokenHandling.cs | 9 ++-- .../GetPowerPlatformEnvironment.cs | 28 ++++++---- .../PowerPlatform/PowerApps/GetPowerApp.cs | 41 ++++++++++----- .../PowerAutomate/DisableFlow.cs | 6 +-- .../PowerPlatform/PowerAutomate/EnableFlow.cs | 6 +-- .../PowerPlatform/PowerAutomate/ExportFlow.cs | 6 +-- .../PowerPlatform/PowerAutomate/GetFlow.cs | 35 ++++++++++--- .../PowerPlatform/PowerAutomate/GetFlowRun.cs | 6 +-- .../PowerPlatform/PowerAutomate/RemoveFlow.cs | 4 +- .../PowerAutomate/RestartFlowRun.cs | 6 +-- .../PowerAutomate/StopFlowRun.cs | 6 +-- 21 files changed, 229 insertions(+), 90 deletions(-) create mode 100644 src/Commands/Base/PnPAzureManagementApiCmdlet.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 80266b25d..41387fbbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `Get-PnPAzureACSPrincipal` cmdlet to retrieve list of installed Azure ACS Principals in the site collection or tenant. [#2920](https://github.com/pnp/powershell/pull/2920) - Added `-LogoFilePath` parameter to `Register-PnPAzureADApp` cmdlet to allow setting the logo for the Azure AD app. [#2881](https://github.com/pnp/powershell/pull/2881) - Added support for `-Verbose` in `Move-PnPFile` which will show if it has problems determining if the destination location is a folder or a file [#2888](https://github.com/pnp/powershell/pull/2888) +- Added `-Identity` option to `Get-PnPPowerPlatformEnvironment` which allows retrieval of one specific environment by its displayname or id. +- Added `Get-PnPPowerApp` which allows PowerApps to be retrieved ### Changed @@ -77,6 +79,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed support for PowerShell 5, only PowerShell 7.2 and later will be supported from here onwards [#2764](https://github.com/pnp/powershell/pull/2764) - Removed `Get-PnPSubscribeSharePointNewsDigest` and `Set-PnPSubscribeSharePointNewsDigest` as the implementation behind these features has been changed in SharePoint Online causing them no longer to work. At present, there's no alternative for this that we can call into thus we will have to remove these in a future version. There is a Design Change Request open with the Program Group to add back APIs for doing this. If that will be accepted and implemented, we will add these back again. [#2720](https://github.com/pnp/powershell/pull/2720) - Removed `-ReturnTyped` parameter from the `Get-PnPField` cmdlet. The retrieved fields will always be returned by their `TypeKind`. [#2849](https://github.com/pnp/powershell/pull/2849) +- Removed alias `Get-PnPFlowEnvironment` from `Get-PnPPowerPlatformEnvironment`. Please use the latter going forward. ### Fixed diff --git a/MIGRATE-1.0-to-2.0.md b/MIGRATE-1.0-to-2.0.md index 9cb004e79..3354aa0f6 100644 --- a/MIGRATE-1.0-to-2.0.md +++ b/MIGRATE-1.0-to-2.0.md @@ -75,6 +75,7 @@ Using PnP PowerShell in Azure functions ? You might be required to change the Pn | Export-PnPTaxonomy | - | - | The cmdlet does not support export of taxonomy using `UTF-7` encoding. If `UTF-7` is specified, it will switch to `UTF-8` encoding | | Get-PnPField | ReturnTyped | - | The cmdlet will always return the typed object of the field. | | Get-PnPUserProfileProperty | - | - | Additional user profile properties are no longer returned under UserProfileProperties but instead will be directly under the returned instance | +| Get-PnPFlowEnvironment | - | - | The alias on the cmdlet has been removed. Use `PnPPowerPlatformEnvironment` instead. | ## Other notable changes diff --git a/documentation/Get-PnPFlow.md b/documentation/Get-PnPFlow.md index d6c4a45f7..6a622e66b 100644 --- a/documentation/Get-PnPFlow.md +++ b/documentation/Get-PnPFlow.md @@ -20,8 +20,8 @@ Returns the flows for a given environment ## SYNTAX ```powershell -Get-PnPFlow -Environment [-AsAdmin] [-Identity ] -[-Connection ] [] +Get-PnPFlow [-Environment ] [-AsAdmin] [-Identity ] +[-Connection ] [-Verbose] ``` ## DESCRIPTION @@ -31,17 +31,15 @@ This cmdlet returns the flows for a given environment. ### Example 1 ```powershell -$environment = Get-PnPPowerPlatformEnvironment -Get-PnPFlow -Environment $environment +Get-PnPPowerPlatformEnvironment -Identity "MyOrganization (default)" | Get-PnPFlow ``` This returns all the flows for a given Power Platform environment ### Example 2 ```powershell -$environment = Get-PnPPowerPlatformEnvironment -Get-PnPFlow -Environment $environment -Identity fba63225-baf9-4d76-86a1-1b42c917a182 +Get-PnPFlow -Identity fba63225-baf9-4d76-86a1-1b42c917a182 ``` -This returns a specific flow +This returns a specific flow from the default environment ## PARAMETERS @@ -53,9 +51,9 @@ Type: PowerAutomateEnvironmentPipeBind Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named -Default value: None +Default value: The default environment Accept pipeline input: False Accept wildcard characters: False ``` @@ -106,8 +104,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` -## RELATED LINKS +### -Verbose +When provided, additional debug statements will be shown while executing the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) -[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) +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) \ No newline at end of file diff --git a/documentation/Get-PnPPowerApp.md b/documentation/Get-PnPPowerApp.md index ea23fcf37..75b3fc1f5 100644 --- a/documentation/Get-PnPPowerApp.md +++ b/documentation/Get-PnPPowerApp.md @@ -20,8 +20,8 @@ Returns the Power Apps for a given environment ## SYNTAX ```powershell -Get-PnPPowerApp -Environment [-AsAdmin] [-Identity ] -[-Connection ] [] +Get-PnPPowerApp [-Environment ] [-AsAdmin] [-Identity ] +[-Connection ] [-Verbose] ``` ## DESCRIPTION @@ -53,10 +53,10 @@ Type: PowerPlatformEnvironmentPipeBind Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named -Default value: None -Accept pipeline input: False +Default value: The default environment +Accept pipeline input: True Accept wildcard characters: False ``` @@ -106,8 +106,20 @@ Accept pipeline input: False Accept wildcard characters: False ``` -## RELATED LINKS +### -Verbose +When provided, additional debug statements will be shown while executing the cmdlet. -[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) +```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) \ No newline at end of file diff --git a/documentation/Get-PnPPowerPlatformEnvironment.md b/documentation/Get-PnPPowerPlatformEnvironment.md index 45152337c..5efd4710e 100644 --- a/documentation/Get-PnPPowerPlatformEnvironment.md +++ b/documentation/Get-PnPPowerPlatformEnvironment.md @@ -19,12 +19,20 @@ Retrieves the Microsoft Power Platform environments for the current tenant. ## SYNTAX +### Default (Default) + +```powershell +Get-PnPPowerPlatformEnvironment [-IsDefault] [-Connection ] [-Verbose] +``` + +### By Identity + ```powershell -Get-PnPPowerPlatformEnvironment [-Connection ] [] +Get-PnPPowerPlatformEnvironment -Identity [-Connection ] [-Verbose] ``` ## DESCRIPTION -This cmdlet retrieves the Microsoft Power Platform environments for the current tenant +This cmdlet retrieves all of the Microsoft Power Platform environments for the current tenant ## EXAMPLES @@ -33,7 +41,7 @@ This cmdlet retrieves the Microsoft Power Platform environments for the current Get-PnPPowerPlatformEnvironment ``` -This cmdlets returns the Power Platform environments for the current tenant. +This cmdlets returns all of the Power Platform environments for the current tenant. ### Example 2 ```powershell @@ -42,14 +50,36 @@ Get-PnPPowerPlatformEnvironment -IsDefault $true This cmdlets returns the default Power Platform environment for the current tenant. +### Example 3 +```powershell +Get-PnPPowerPlatformEnvironment -Identity "MyOrganization (default)" +``` + +This cmdlets returns the Power Platform environment with the provided display name for the current tenant. + ## PARAMETERS +### -Identity +Allows specifying an environment display name or internal name to retrieve a specific environment. + +```yaml +Type: bool +Parameter Sets: By Identity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -IsDefault Allows retrieval of the default Power Platform environment by passing in `-IsDefault $true`. When passing in `-IsDefault $false` you will get all non default environments. If not provided at all, all available environments, both default and non-default, will be returned. ```yaml Type: bool -Parameter Sets: (All) +Parameter Sets: Default Aliases: Required: False @@ -75,6 +105,20 @@ 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) \ No newline at end of file diff --git a/src/Commands/Apps/AddApp.cs b/src/Commands/Apps/AddApp.cs index 40ca4488b..4768042ce 100644 --- a/src/Commands/Apps/AddApp.cs +++ b/src/Commands/Apps/AddApp.cs @@ -1,7 +1,5 @@ using PnP.Framework.ALM; using PnP.Framework.Enums; - -using PnP.PowerShell.Commands.Enums; using System.Management.Automation; namespace PnP.PowerShell.Commands.Apps @@ -9,7 +7,6 @@ namespace PnP.PowerShell.Commands.Apps [Cmdlet(VerbsCommon.Add, "PnPApp")] public class AddApp : PnPSharePointCmdlet { - [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true)] public string Path; @@ -52,7 +49,6 @@ protected override void ExecuteCmdlet() { result = manager.GetAvailable(result.Id, Scope); } - } WriteObject(result); } diff --git a/src/Commands/Base/PnPAzureManagementApiCmdlet.cs b/src/Commands/Base/PnPAzureManagementApiCmdlet.cs new file mode 100644 index 000000000..e7dfdced9 --- /dev/null +++ b/src/Commands/Base/PnPAzureManagementApiCmdlet.cs @@ -0,0 +1,38 @@ +using System.Management.Automation; +using Microsoft.SharePoint.Client; + +namespace PnP.PowerShell.Commands.Base +{ + /// + /// Base class for all the PnP Azure Management API related cmdlets + /// + public abstract class PnPAzureManagementApiCmdlet : PnPConnectedCmdlet + { + /// + /// Returns an Access Token for the Azure Management API, if available, otherwise NULL + /// + public string AccessToken + { + get + { + if (Connection?.Context != null) + { + return TokenHandler.GetAccessToken(this, "https://management.azure.com/.default", Connection); + } + return null; + } + } + + protected override void BeginProcessing() + { + base.BeginProcessing(); + if (Connection?.Context != null) + { + if (Connection?.Context.GetContextSettings().Type == Framework.Utilities.Context.ClientContextType.Cookie) + { + throw new PSInvalidOperationException("This cmdlet not work with a WebLogin/Cookie based connection towards SharePoint."); + } + } + } + } +} \ No newline at end of file diff --git a/src/Commands/Base/PnPGraphCmdlet.cs b/src/Commands/Base/PnPGraphCmdlet.cs index a888fa748..7ce69c5c8 100644 --- a/src/Commands/Base/PnPGraphCmdlet.cs +++ b/src/Commands/Base/PnPGraphCmdlet.cs @@ -54,10 +54,8 @@ public string AccessToken else { if (Connection?.Context != null) - { - WriteVerbose("Acquiring token for default permissions on resource " + Connection.GraphEndPoint + " using the current context"); - var accessToken = TokenHandler.GetAccessToken(GetType(), $"https://{Connection.GraphEndPoint}/.default", Connection); - WriteVerbose("Access token acquired through the current context: " + accessToken); + { + var accessToken = TokenHandler.GetAccessToken(this, $"https://{Connection.GraphEndPoint}/.default", Connection); return accessToken; } } diff --git a/src/Commands/Base/PnPOfficeManagementApiCmdlet.cs b/src/Commands/Base/PnPOfficeManagementApiCmdlet.cs index 41f630d78..095f3591e 100644 --- a/src/Commands/Base/PnPOfficeManagementApiCmdlet.cs +++ b/src/Commands/Base/PnPOfficeManagementApiCmdlet.cs @@ -19,7 +19,7 @@ public string AccessToken { if (Connection?.Context != null) { - return TokenHandler.GetAccessToken(GetType(), "https://manage.office.com/.default", Connection); + return TokenHandler.GetAccessToken(this, "https://manage.office.com/.default", Connection); } return null; } diff --git a/src/Commands/Base/PnPSharePointCmdlet.cs b/src/Commands/Base/PnPSharePointCmdlet.cs index f784ce411..3d8d26e95 100644 --- a/src/Commands/Base/PnPSharePointCmdlet.cs +++ b/src/Commands/Base/PnPSharePointCmdlet.cs @@ -81,7 +81,7 @@ public string GraphAccessToken { if (Connection?.Context != null) { - return TokenHandler.GetAccessToken(GetType(), $"https://{Connection.GraphEndPoint}/.default", Connection); + return TokenHandler.GetAccessToken(this, $"https://{Connection.GraphEndPoint}/.default", Connection); } } diff --git a/src/Commands/Base/TokenHandling.cs b/src/Commands/Base/TokenHandling.cs index f7f303df6..d2f05a717 100644 --- a/src/Commands/Base/TokenHandling.cs +++ b/src/Commands/Base/TokenHandling.cs @@ -48,7 +48,7 @@ internal static void ValidateTokenForPermissions(Type cmdletType, string token) } } - internal static string GetAccessToken(Type cmdletType, string appOnlyDefaultScope, PnPConnection connection) + internal static string GetAccessToken(Cmdlet cmdlet, string appOnlyDefaultScope, PnPConnection connection) { var contextSettings = connection.Context.GetContextSettings(); var authManager = contextSettings.AuthenticationManager; @@ -62,9 +62,9 @@ internal static string GetAccessToken(Type cmdletType, string appOnlyDefaultScop string[] requiredScopes = null; RequiredMinimalApiPermissions requiredScopesAttribute = null; - if (cmdletType != null) + if (cmdlet != null && cmdlet.GetType() != null) { - requiredScopesAttribute = (RequiredMinimalApiPermissions)Attribute.GetCustomAttribute(cmdletType, typeof(RequiredMinimalApiPermissions)); + requiredScopesAttribute = (RequiredMinimalApiPermissions)Attribute.GetCustomAttribute(cmdlet.GetType(), typeof(RequiredMinimalApiPermissions)); } if (requiredScopesAttribute != null) { @@ -78,7 +78,10 @@ internal static string GetAccessToken(Type cmdletType, string appOnlyDefaultScop { requiredScopes = new[] { appOnlyDefaultScope }; } + + cmdlet.WriteVerbose($"Acquiring oAuth token for {(requiredScopes.Length != 1 ? requiredScopes.Length + " " : "")}permission scope{(requiredScopes.Length != 1 ? "s" : "")} {string.Join(",", requiredScopes)}"); var accessToken = authManager.GetAccessTokenAsync(requiredScopes).GetAwaiter().GetResult(); + cmdlet.WriteVerbose($"Access token acquired: {accessToken}"); return accessToken; } return null; diff --git a/src/Commands/PowerPlatform/Environment/GetPowerPlatformEnvironment.cs b/src/Commands/PowerPlatform/Environment/GetPowerPlatformEnvironment.cs index 11260024b..3d42e54f4 100644 --- a/src/Commands/PowerPlatform/Environment/GetPowerPlatformEnvironment.cs +++ b/src/Commands/PowerPlatform/Environment/GetPowerPlatformEnvironment.cs @@ -3,25 +3,35 @@ using PnP.PowerShell.Commands.Utilities.REST; using System.Management.Automation; using System.Linq; +using PnP.PowerShell.Commands.Base.PipeBinds; namespace PnP.PowerShell.Commands.PowerPlatform.Environment { - [Cmdlet(VerbsCommon.Get, "PnPPowerPlatformEnvironment")] - [Alias("Get-PnPFlowEnvironment")] - [WriteAliasWarning("Get-PnPFlowEnvironment has been replaced by Get-PnPPowerPlatformEnvironment. It will be removed in a future version. Please update your scripts.")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class GetPowerPlatformEnvironment : PnPGraphCmdlet + [Cmdlet(VerbsCommon.Get, "PnPPowerPlatformEnvironment", DefaultParameterSetName = ParameterSet_DEFAULT)] + public class GetPowerPlatformEnvironment : PnPAzureManagementApiCmdlet { - [Parameter(Mandatory = false)] - public bool? IsDefault; + private const string ParameterSet_BYIDENTITY = "By Identity"; + private const string ParameterSet_DEFAULT = "Default"; + + [Parameter(Mandatory = false, ParameterSetName = ParameterSet_DEFAULT)] + public SwitchParameter IsDefault; + + [Parameter(Mandatory = true, ParameterSetName = ParameterSet_BYIDENTITY)] + public PowerPlatformEnvironmentPipeBind Identity; protected override void ExecuteCmdlet() { var environments = GraphHelper.GetResultCollectionAsync(Connection, "https://management.azure.com/providers/Microsoft.ProcessSimple/environments?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); - if(ParameterSpecified(nameof(IsDefault)) && IsDefault.HasValue) + if(ParameterSpecified(nameof(IsDefault)) && IsDefault.ToBool()) + { + environments = environments.Where(e => e.Properties.IsDefault.HasValue && e.Properties.IsDefault == IsDefault.ToBool()); + } + + if(ParameterSpecified(nameof(Identity))) { - environments = environments.Where(e => e.Properties.IsDefault.HasValue && e.Properties.IsDefault == IsDefault.Value); + var environmentName = Identity.GetName(); + environments = environments.Where(e => e.Properties.DisplayName == environmentName || e.Name == environmentName); } WriteObject(environments, true); diff --git a/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs b/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs index bda237b5f..68c569df6 100644 --- a/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs +++ b/src/Commands/PowerPlatform/PowerApps/GetPowerApp.cs @@ -1,22 +1,17 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Management.Automation; - namespace PnP.PowerShell.Commands.PowerPlatform.PowerApps { [Cmdlet(VerbsCommon.Get, "PnPPowerApp")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class GetPowerApp : PnPGraphCmdlet + [OutputType(typeof(Model.PowerPlatform.PowerApp.PowerApp))] + public class GetPowerApp : PnPAzureManagementApiCmdlet { - - [Parameter(Mandatory = true)] + [Parameter(Mandatory = false, ValueFromPipeline = true)] public PowerPlatformEnvironmentPipeBind Environment; [Parameter(Mandatory = false)] @@ -27,21 +22,43 @@ public class GetPowerApp : PnPGraphCmdlet protected override void ExecuteCmdlet() { - var environmentName = Environment.GetName(); + string environmentName = null; + if(ParameterSpecified(nameof(Environment))) + { + environmentName = Environment.GetName(); + + WriteVerbose($"Using environment as provided '{environmentName}'"); + } + else + { + var environments = GraphHelper.GetResultCollectionAsync(Connection, "https://management.azure.com/providers/Microsoft.ProcessSimple/environments?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); + environmentName = environments.FirstOrDefault(e => e.Properties.IsDefault.HasValue && e.Properties.IsDefault == true)?.Name; + + if(string.IsNullOrEmpty(environmentName)) + { + throw new Exception($"No default environment found, please pass in a specific environment name using the {nameof(Environment)} parameter"); + } + + WriteVerbose($"Using default environment as retrieved '{environmentName}'"); + } if (ParameterSpecified(nameof(Identity))) { var appName = Identity.GetName(); + + WriteVerbose($"Retrieving specific PowerApp with the provided name '{appName}' within the environment '{environmentName}'"); + var result = GraphHelper.GetAsync(Connection, $"https://api.powerapps.com/providers/Microsoft.PowerApps{(AsAdmin ? "/scopes/admin/environments/" + environmentName : "")}/apps/{appName}?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); WriteObject(result, false); } else { + WriteVerbose($"Retrieving all PowerApps within environment '{environmentName}'"); + var apps = GraphHelper.GetResultCollectionAsync(Connection, $"https://api.powerapps.com/providers/Microsoft.PowerApps/apps?api-version=2016-11-01&$filter=environment eq '{environmentName}'", AccessToken).GetAwaiter().GetResult(); WriteObject(apps, true); } } - } -} +} \ No newline at end of file diff --git a/src/Commands/PowerPlatform/PowerAutomate/DisableFlow.cs b/src/Commands/PowerPlatform/PowerAutomate/DisableFlow.cs index b7e9bb471..24c5d28cb 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/DisableFlow.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/DisableFlow.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; using System.Management.Automation; @@ -7,8 +6,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsLifecycle.Disable, "PnPFlow")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class DisableFlow : PnPGraphCmdlet + public class DisableFlow : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; diff --git a/src/Commands/PowerPlatform/PowerAutomate/EnableFlow.cs b/src/Commands/PowerPlatform/PowerAutomate/EnableFlow.cs index 8e38b9fd5..19247c99e 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/EnableFlow.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/EnableFlow.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; using System.Management.Automation; @@ -7,8 +6,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsLifecycle.Enable, "PnPFlow")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class EnableFlow : PnPGraphCmdlet + public class EnableFlow : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; diff --git a/src/Commands/PowerPlatform/PowerAutomate/ExportFlow.cs b/src/Commands/PowerPlatform/PowerAutomate/ExportFlow.cs index 393342dad..1672d3e81 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/ExportFlow.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/ExportFlow.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; using System; @@ -10,8 +9,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsData.Export, "PnPFlow")] - [RequiredMinimalApiPermissions("https://management.azure.com//.default")] - public class ExportFlow : PnPGraphCmdlet + public class ExportFlow : PnPAzureManagementApiCmdlet { private const string ParameterSet_ASJSON = "As Json"; private const string ParameterSet_ASPACKAGE = "As ZIP Package"; diff --git a/src/Commands/PowerPlatform/PowerAutomate/GetFlow.cs b/src/Commands/PowerPlatform/PowerAutomate/GetFlow.cs index 5bd3bb913..6145a06af 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/GetFlow.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/GetFlow.cs @@ -1,18 +1,16 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; -using System.Collections.Generic; +using System; using System.Linq; using System.Management.Automation; namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsCommon.Get, "PnPFlow")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class GetFlow : PnPGraphCmdlet + public class GetFlow : PnPAzureManagementApiCmdlet { - [Parameter(Mandatory = true)] + [Parameter(Mandatory = false, ValueFromPipeline = true)] public PowerPlatformEnvironmentPipeBind Environment; [Parameter(Mandatory = false)] @@ -23,16 +21,39 @@ public class GetFlow : PnPGraphCmdlet protected override void ExecuteCmdlet() { - var environmentName = Environment.GetName(); + string environmentName = null; + if(ParameterSpecified(nameof(Environment))) + { + environmentName = Environment.GetName(); + + WriteVerbose($"Using environment as provided '{environmentName}'"); + } + else + { + var environments = GraphHelper.GetResultCollectionAsync(Connection, "https://management.azure.com/providers/Microsoft.ProcessSimple/environments?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); + environmentName = environments.FirstOrDefault(e => e.Properties.IsDefault.HasValue && e.Properties.IsDefault == true)?.Name; + + if(string.IsNullOrEmpty(environmentName)) + { + throw new Exception($"No default environment found, please pass in a specific environment name using the {nameof(Environment)} parameter"); + } + + WriteVerbose($"Using default environment as retrieved '{environmentName}'"); + } if (ParameterSpecified(nameof(Identity))) { var flowName = Identity.GetName(); + + WriteVerbose($"Retrieving specific Power Automate Flow with the provided name '{flowName}' within the environment '{environmentName}'"); + var result = GraphHelper.GetAsync(Connection, $"https://management.azure.com/providers/Microsoft.ProcessSimple{(AsAdmin ? "/scopes/admin" : "")}/environments/{environmentName}/flows/{flowName}?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); WriteObject(result, false); } else { + WriteVerbose($"Retrieving all Power Automate Flows within environment '{environmentName}'"); + var flows = GraphHelper.GetResultCollectionAsync(Connection, $"https://management.azure.com/providers/Microsoft.ProcessSimple{(AsAdmin ? "/scopes/admin" : "")}/environments/{environmentName}/flows?api-version=2016-11-01", AccessToken).GetAwaiter().GetResult(); WriteObject(flows, true); } diff --git a/src/Commands/PowerPlatform/PowerAutomate/GetFlowRun.cs b/src/Commands/PowerPlatform/PowerAutomate/GetFlowRun.cs index cd4bd7c3f..5f103bcf6 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/GetFlowRun.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/GetFlowRun.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Model.PowerPlatform.PowerAutomate; using PnP.PowerShell.Commands.Utilities.REST; @@ -8,8 +7,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsCommon.Get, "PnPFlowRun")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class GetFlowRun : PnPGraphCmdlet + public class GetFlowRun : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; diff --git a/src/Commands/PowerPlatform/PowerAutomate/RemoveFlow.cs b/src/Commands/PowerPlatform/PowerAutomate/RemoveFlow.cs index b61e2938a..fec036da4 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/RemoveFlow.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/RemoveFlow.cs @@ -1,4 +1,3 @@ -using PnP.PowerShell.Commands.Attributes; using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Utilities.REST; @@ -7,8 +6,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsCommon.Remove, "PnPFlow")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class RemoveFlow : PnPGraphCmdlet + public class RemoveFlow : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; diff --git a/src/Commands/PowerPlatform/PowerAutomate/RestartFlowRun.cs b/src/Commands/PowerPlatform/PowerAutomate/RestartFlowRun.cs index 3bf947246..990820517 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/RestartFlowRun.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/RestartFlowRun.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using PnP.PowerShell.Commands.Model.PowerPlatform.PowerAutomate; using PnP.PowerShell.Commands.Properties; @@ -10,8 +9,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsLifecycle.Restart, "PnPFlowRun")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class RestartFlowRun : PnPGraphCmdlet + public class RestartFlowRun : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; diff --git a/src/Commands/PowerPlatform/PowerAutomate/StopFlowRun.cs b/src/Commands/PowerPlatform/PowerAutomate/StopFlowRun.cs index 6f5b063e7..61019b1b1 100644 --- a/src/Commands/PowerPlatform/PowerAutomate/StopFlowRun.cs +++ b/src/Commands/PowerPlatform/PowerAutomate/StopFlowRun.cs @@ -1,5 +1,4 @@ -using PnP.PowerShell.Commands.Attributes; -using PnP.PowerShell.Commands.Base; +using PnP.PowerShell.Commands.Base; using PnP.PowerShell.Commands.Base.PipeBinds; using System.Management.Automation; using PnP.PowerShell.Commands.Utilities.REST; @@ -8,8 +7,7 @@ namespace PnP.PowerShell.Commands.PowerPlatform.PowerAutomate { [Cmdlet(VerbsLifecycle.Stop, "PnPFlowRun")] - [RequiredMinimalApiPermissions("https://management.azure.com/.default")] - public class StopFlowRun : PnPGraphCmdlet + public class StopFlowRun : PnPAzureManagementApiCmdlet { [Parameter(Mandatory = true)] public PowerPlatformEnvironmentPipeBind Environment; From 7a2276bdd5385bb93bb6aa86a523090e648a31a0 Mon Sep 17 00:00:00 2001 From: Koen Zomers Date: Thu, 23 Mar 2023 17:10:42 +0100 Subject: [PATCH 4/4] Added PR references --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41387fbbd..8db46e19e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,8 +54,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Added `Get-PnPAzureACSPrincipal` cmdlet to retrieve list of installed Azure ACS Principals in the site collection or tenant. [#2920](https://github.com/pnp/powershell/pull/2920) - Added `-LogoFilePath` parameter to `Register-PnPAzureADApp` cmdlet to allow setting the logo for the Azure AD app. [#2881](https://github.com/pnp/powershell/pull/2881) - Added support for `-Verbose` in `Move-PnPFile` which will show if it has problems determining if the destination location is a folder or a file [#2888](https://github.com/pnp/powershell/pull/2888) -- Added `-Identity` option to `Get-PnPPowerPlatformEnvironment` which allows retrieval of one specific environment by its displayname or id. -- Added `Get-PnPPowerApp` which allows PowerApps to be retrieved +- Added `-Identity` option to `Get-PnPPowerPlatformEnvironment` which allows retrieval of one specific environment by its displayname or id. [#2794](https://github.com/pnp/powershell/pull/2794) +- Added `Get-PnPPowerApp` which allows PowerApps to be retrieved [#2794](https://github.com/pnp/powershell/pull/2794) ### Changed @@ -79,7 +79,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Removed support for PowerShell 5, only PowerShell 7.2 and later will be supported from here onwards [#2764](https://github.com/pnp/powershell/pull/2764) - Removed `Get-PnPSubscribeSharePointNewsDigest` and `Set-PnPSubscribeSharePointNewsDigest` as the implementation behind these features has been changed in SharePoint Online causing them no longer to work. At present, there's no alternative for this that we can call into thus we will have to remove these in a future version. There is a Design Change Request open with the Program Group to add back APIs for doing this. If that will be accepted and implemented, we will add these back again. [#2720](https://github.com/pnp/powershell/pull/2720) - Removed `-ReturnTyped` parameter from the `Get-PnPField` cmdlet. The retrieved fields will always be returned by their `TypeKind`. [#2849](https://github.com/pnp/powershell/pull/2849) -- Removed alias `Get-PnPFlowEnvironment` from `Get-PnPPowerPlatformEnvironment`. Please use the latter going forward. +- Removed alias `Get-PnPFlowEnvironment` from `Get-PnPPowerPlatformEnvironment`. Please use the latter going forward. [#2794](https://github.com/pnp/powershell/pull/2794) ### Fixed