Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions samples/power-automate-flow-to-share-an-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# msbuild output directories
/bin
/obj

# MSBuild Binary and Structured Log
*.binlog
54 changes: 54 additions & 0 deletions samples/power-automate-flow-to-share-an-app/AppSharing.cdsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props')" />

<PropertyGroup>
<ProjectGuid>f38a1755-1c81-4ac7-9d1b-638f3a19df92</ProjectGuid>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<!--Remove TargetFramework when this is available in 16.1-->
<TargetFramework>net462</TargetFramework>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<SolutionRootPath>src</SolutionRootPath>
</PropertyGroup>

<!--
Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
Solution Localization Control, if you want to enabled localization of your solution, un-comment SolutionPackageEnableLocalization and set the value to true. - Requires use of -loc flag on Solution Clone or Sync
-->
<!--
<PropertyGroup>
<SolutionPackageType>Managed</SolutionPackageType>
<SolutionPackageEnableLocalization>false</SolutionPackageEnableLocalization>
</PropertyGroup>
-->

<ItemGroup>
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
<Content Include="$(SolutionPackageZipFilePath)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets')" />

</Project>
86 changes: 86 additions & 0 deletions samples/power-automate-flow-to-share-an-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Power Automate flow to automate sharing of a Canvas App

## Summary

This sample is a cloud flow that can be used to automate sharing of a canvas app. This flow initializes App ID variable & then uses a Switch condition to set the App ID variable based on the App Name present in a SharePoint List. It then leverages Apply to each to get users from SharePoint list, and uses Get User Entra ID action to get the user id based on email address. Finally, Edit App Role Assignment action is used to share the canvas app.

![Flow overview](./assets/flow-overview.png)
![Flow overview](./assets/apply-to-each.png)


## Applies to

![Power Automate](https://img.shields.io/badge/Power%20Automate-No-red "Yes")


## Compatibility

![Premium License](https://img.shields.io/badge/Premium%20License-Not%20Required-red.svg "Premium license not required")
![Experimental Features](https://img.shields.io/badge/Experimental%20Features-No-red.svg "Does not rely on experimental features")

## Contributors

* [Vipul Jain](https://github.com/vipulj03/)

## Version history

Version|Date|Comments
-------|----|--------
1.0|March 05, 2025|Initial release
2.0|June 01, 2025|Updated Version with suggested changes

## Prerequisites
* This app uses Microsoft Entra ID connection.
* This app uses **Edit App Role Assignment** action.
* This app uses SharePoint as a data source and requires a SharePoint List with the following fields:
- List Name: App Sharing
- List Fields:
- Users (Person or Group) => allow multiple selection = yes
- AppNameNew (Choice) => E.g. - names of your app in the environment
- AppID (Single line of text) => enter the app ID of your app. This value will be read dynamically in the flow.

## Minimal path to awesome

### Using the solution zip

* [Download](./solution/power-automate-flow-to-share-an-app.zip) the `.zip` from the `solution` folder
* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed.
* Open the app in edit mode and make sure the data source **Data source name** is connected correctly.

### Using the source code

You can also use the [Power Apps CLI](https://docs.microsoft.com/powerapps/developer/data-platform/powerapps-cli) to pack the source code by following these steps:

* Clone the repository to a local drive
* Pack the source files back into a solution `.zip` file:

```bash
pac solution pack --zipfile pathtodestinationfile --folder pathtosourcefolder --processCanvasApps
```

Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtodestinationfile` to point to the path of this solution's `.zip` file (located under the `solution` folder)
* Within **Power Apps Studio**, import the solution `.zip` file using **Solutions** > **Import Solution** and select the `.zip` file you just packed.

## Features

This sample illustrates the following concepts:
* Automate the sharing of Canvas App, instead of manually sharing the app with multiple users
* Use of Switch case in power automate flow
* Use of Microsoft Entra ID action to get the user id
* Use of Edit App Role Assignment action to assign the users to an app

## Help

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you encounter any issues while using this sample, you can [create a new issue](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=power-automate-flow-to-share-an-app&authors=@vipulj03&title=power-automate-flow-to-share-an-app%20-%20).

For questions regarding this sample, [create a new question](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=power-automate-flow-to-share-an-app&authors=@vipulj03&title=power-automate-flow-to-share-an-app%20-%20).

Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=power-automate-flow-to-share-an-app&authors=@vipulj03&title=power-automate-flow-to-share-an-app%20-%20).

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-samples/samples/power-automate-flow-to-share-an-app" aria-hidden="true" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions samples/power-automate-flow-to-share-an-app/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"name": "pnp-powerplatform-samples-power-automate-flow-to-share-an-app",
"source": "pnp",
"title": "Power Automate flow to automate sharing of a Canvas App",
"shortDescription": "This sample is a cloud flow that can be used to automate sharing of a canvas app.",
"url": "https://github.com/pnp/powerplatform-samples/tree/main/samples/power-automate-flow-to-share-an-app",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/powerplatform-samples/tree/main/samples/power-automate-flow-to-share-an-app",
"longDescription": [
"This sample is a cloud flow that can be used to automate sharing of a canvas app."
],
"creationDateTime": "2025-03-05",
"updateDateTime": "2025-06-01",
"products": [
"Power Automate",
"Power Platform"
],
"tags": [
"Flow",
"Share"
],
"categories": [
"CLOUD-FLOW"
],
"metadata": [
{
"key": "POWERAPPS-EXPERIMENTAL",
"value": "No"
},
{
"key": "POWERAPPS-PREMIUM",
"value": "No"
},
{
"key": "POWERAPPS-ONPREM",
"value": "No"
},
{
"key": "POWERAPPS-CUSTOMCONNECTOR",
"value": "No"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/powerplatform-samples/raw/main/samples/power-automate-flow-to-share-an-app/assets/flow-overview.png",
"alt": "App preview"
}
],
"authors": [
{
"gitHubAccount": "vipulj03",
"pictureUrl": "https://github.com/vipulj03.png",
"name": "Vipul Jain"
}
],
"references": [
{
"name": "Microsoft Power Platform documentation",
"description": "Discover how to make the most of Microsoft Power Platform products with online training courses, docs, and videos covering product capabilities and how-to guides.",
"url": "https://learn.microsoft.com/power-platform/"
}
]
}
]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.25091.158" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.25091.00158">
<Entities />
<Roles />
<Workflows />
<FieldSecurityProfiles />
<Templates />
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<CustomControls />
<EntityDataProviders />
<connectionreferences>
<connectionreference connectionreferencelogicalname="new_sharedazuread_69386">
<connectionreferencedisplayname>Microsoft Entra ID AppSharing-69386</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_azuread</connectorid>
<iscustomizable>1</iscustomizable>
<promptingbehavior>0</promptingbehavior>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
<connectionreference connectionreferencelogicalname="new_sharedpowerappsforappmakers_3c6c8">
<connectionreferencedisplayname>Power Apps for Makers AppSharing-3c6c8</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_powerappsforappmakers</connectorid>
<iscustomizable>1</iscustomizable>
<promptingbehavior>0</promptingbehavior>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
<connectionreference connectionreferencelogicalname="new_sharedsharepointonline_1d8cd">
<connectionreferencedisplayname>SharePoint AppSharing-1d8cd</connectionreferencedisplayname>
<connectorid>/providers/Microsoft.PowerApps/apis/shared_sharepointonline</connectorid>
<iscustomizable>1</iscustomizable>
<promptingbehavior>0</promptingbehavior>
<statecode>0</statecode>
<statuscode>1</statuscode>
</connectionreference>
</connectionreferences>
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
87 changes: 87 additions & 0 deletions samples/power-automate-flow-to-share-an-app/src/Other/Solution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<ImportExportXml version="9.2.25091.158" SolutionPackageVersion="9.2" languagecode="1033" generatedBy="CrmLive" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" OrganizationVersion="9.2.25091.158" OrganizationSchemaType="Standard" CRMServerServiceabilityVersion="9.2.25091.00158">
<SolutionManifest>
<UniqueName>AppSharing</UniqueName>
<LocalizedNames>
<LocalizedName description="AppSharing" languagecode="1033" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0.0</Version>
<Managed>2</Managed>
<Publisher>
<UniqueName>DefaultPublisherorgdd6add56</UniqueName>
<LocalizedNames>
<LocalizedName description="Default Publisher for orgdd6add56" languagecode="1033" />
</LocalizedNames>
<Descriptions>
<Description description="Default publisher for this organization" languagecode="1033" />
</Descriptions>
<EMailAddress xsi:nil="true"></EMailAddress>
<SupportingWebsiteUrl xsi:nil="true"></SupportingWebsiteUrl>
<CustomizationPrefix>new</CustomizationPrefix>
<CustomizationOptionValuePrefix>10000</CustomizationOptionValuePrefix>
<Addresses>
<Address>
<AddressNumber>1</AddressNumber>
<AddressTypeCode xsi:nil="true"></AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode xsi:nil="true"></ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
<Address>
<AddressNumber>2</AddressNumber>
<AddressTypeCode xsi:nil="true"></AddressTypeCode>
<City xsi:nil="true"></City>
<County xsi:nil="true"></County>
<Country xsi:nil="true"></Country>
<Fax xsi:nil="true"></Fax>
<FreightTermsCode xsi:nil="true"></FreightTermsCode>
<ImportSequenceNumber xsi:nil="true"></ImportSequenceNumber>
<Latitude xsi:nil="true"></Latitude>
<Line1 xsi:nil="true"></Line1>
<Line2 xsi:nil="true"></Line2>
<Line3 xsi:nil="true"></Line3>
<Longitude xsi:nil="true"></Longitude>
<Name xsi:nil="true"></Name>
<PostalCode xsi:nil="true"></PostalCode>
<PostOfficeBox xsi:nil="true"></PostOfficeBox>
<PrimaryContactName xsi:nil="true"></PrimaryContactName>
<ShippingMethodCode xsi:nil="true"></ShippingMethodCode>
<StateOrProvince xsi:nil="true"></StateOrProvince>
<Telephone1 xsi:nil="true"></Telephone1>
<Telephone2 xsi:nil="true"></Telephone2>
<Telephone3 xsi:nil="true"></Telephone3>
<TimeZoneRuleVersionNumber xsi:nil="true"></TimeZoneRuleVersionNumber>
<UPSZone xsi:nil="true"></UPSZone>
<UTCOffset xsi:nil="true"></UTCOffset>
<UTCConversionTimeZoneCode xsi:nil="true"></UTCConversionTimeZoneCode>
</Address>
</Addresses>
</Publisher>
<RootComponents>
<RootComponent type="29" id="{c78d51cf-e9f1-ef11-be20-000d3ac7b386}" behavior="0" />
</RootComponents>
<MissingDependencies />
</SolutionManifest>
</ImportExportXml>
Loading