How To Change Owner Powershell For Powerautomate Application
Many of you take been asking for access to PowerApps and Flow control through PowerShell. This week we have released an extended version of the PowerApps PowerShell script functions (cmdlets) that provide admin access to resources on their instance of PowerApps, Menstruum, and the Business organisation Application Platform in the PowerShell environment.
Updates
- 2019-01-07: Cmdlets are now available on the PowerShell gallery as two dissever modules: Administrator (link) and Maker (link).
- 2019-04-29: Updated cmdlet names
Cmdlets
Cmdlets are functions written in PowerShell script linguistic communication that execute commands in the Windows PowerShell surround. Running these PowerApps cmdlets will let you to interact with your Business Application Platform without having to go through the admin portal in a web browser. You can combine these cmdlets with other PowerShell functions to write complex scripts that can optimize your workflow. Notation that you can all the same use the cmdlets if you're non an admin on the tenant, but you lot will be express to the resource you lot ain. Cmdlets that starting time with the word 'Admin' are designed to be used past an administrative user account.
Installation
- Run PowerShell as an ambassador
- Execute the following import commands:
Install-Module -Name Microsoft.PowerApps.Assistants.PowerShell Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
- If you lot are prompted to accept the modify to InstallationPolicy value of the repository, accept [A] Aye to all modules by typing in 'A' and hitting enter for each module.
- Earlier accessing any of the commands, yous take the option to provide your credentials using the following control. These credentials are refreshed for upwards to ~viii hours before you're required to sign in again to continue using the cmdlets.
# This call opens prompt to collect credentials (AAD business relationship & password) used by the commands Add-PowerAppsAccount
# Here is how you tin can pass in credentials (avoiding opening a prompt) $pass = ConvertTo-SecureString "password" -AsPlainText -Force Add-PowerAppsAccount -Username foo@bar.com -Password $pass
Prerequisite
App creators
Users with a valid PowerApps license can perform the operations in these cmdlets, but they volition only have access to the resource (for case, apps, flows, etc.) that take been created or shared with them.
Administrators
To perform the administration operations in the admin cmdlets, you'll need the following:
- A paid PowerApps Plan 2 license or a PowerApps Programme 2 trial license. You can sign-up for a xxx-day trial license at https://web.powerapps.com/trial. Trial licenses can be renewed if they've expired.
- Function 365 Global Administrator or Azure Active Directory Global Ambassador permissions if y'all need to search through another user's resources. (Notation that Environment Admins merely have access to those environments and environment resources for which they have permissions.)
Cmdlet list
Maker Cmdlets
Purpose | Cmdlet |
Read environments | Get-PowerAppEnvironment Get-FlowEnvironment |
Read, update, and delete a canvas app | Get-PowerApp (Previously Get-App) Remove-PowerApp Publish-PowerApp Ready-PowerAppDisplayName Get-PowerAppVersion Restore-PowerAppVersion |
Read, update, and delete canvas app permissions | Become-PowerAppRoleAssignment Set up-PowerAppRoleAssignment Remove-PowerAppRoleAssignment |
Read, update, and delete a flow | Get-Flow Become-FlowRun Enable-Flow Disable-Menses Remove-Flow |
Read, update, and delete flow permissions | Get-FlowOwnerRole Set-FlowOwnerRole Remove-FlowOwnerRole |
Read and respond to menstruum approvals | Become-FlowApprovalRequest Get-FlowApproval RespondTo-FlowApprovalRequest |
Read and delete connections | Become-PowerAppConnection Remove-PowerAppConnection |
Read, update, and delete connection permissions | Get-PowerAppConnectionRoleAssignment Gear up-PowerAppConnectionRoleAssignment Remove-PowerAppConnectionRoleAssignment |
Read and delete a connector | Get-PowerAppConnector Remove-PowerAppConnector |
Read, update, and delete custom connector permissions | Become-ConnectorRoleAssignment Set-PowerAppConnectorRoleAssignment Remove-PowerAppConnectorRoleAssignment |
Admin Cmdlets
Read, update, and delete environments and Common Data Service databases
Read, update, and delete environments and Common Data Service databases | New-AdminPowerAppEnvironment Set-AdminPowerAppEnvironmentDisplayName Get-AdminPowerAppEnvironment Remove-AdminPowerAppEnvironment New-AdminPowerAppCdsDatabase Become-AdminPowerAppCdsDatabaseLanguages Get-AdminPowerAppCdsDatabaseCurrencies Get-AdminPowerAppEnvironmentLocations Remove-LegacyCDSDatabase *New* |
Read, update, and delete environment permissions (does not piece of work in environment with CDS for Apps database) | Get-AdminPowerAppEnvironmentRoleAssignment Set-AdminPowerAppEnvironmentRoleAssignment Remove-AdminPowerAppEnvironmentRoleAssignment |
Read and remove canvass apps | Get-AdminPowerApp Remove-AdminPowerApp Go-AdminPowerAppConnectionReferences |
Read, update, and delete sail app permissions | Get-AdminPowerAppRoleAssignment Set-AdminPowerAppRoleAssignment Remove-AdminPowerAppRoleAssignment Set up-AdminPowerAppOwner |
Read, update, and delete Flows, Possessor Roles, and Approvals | Get-AdminFlow Enable-AdminFlow Disable-AdminFlow Remove-AdminFlow Get-AdminFlowOwnerRole Set-AdminFlowOwnerRole Remove-AdminFlowOwnerRole Remove-AdminFlowApprovals |
Read and delete connections | Get-AdminPowerAppConnection Remove-AdminPowerAppConnection |
Read, update, and delete connection permissions | Get-AdminPowerAppConnectionRoleAssignment Gear up-AdminPowerAppConnectionRoleAssignment Remove-AdminPowerAppConnectionRoleAssignment |
Read and delete custom connectors | Get-AdminPowerAppConnector Remove-AdminPowerAppConnector |
Read, update, and delete custom connector permissions | Go-AdminPowerAppConnectorRoleAssignment Set-AdminPowerAppConnectorRoleAssignment Remove-AdminPowerAppConnectorRoleAssignment |
Prepare canvass app as hero | Set-AdminPowerAppAsHero Clear-AdminPowerAppAsHero |
Gear up canvas app as featured | Ready-AdminPowerAppAsFeatured Clear-AdminPowerAppAsFeatured |
Set canvas app to bypass api consent | Set-AdminPowerAppApisToBypassConsent Clear-AdminPowerAppApisToBypassConsent |
Read a user'south PowerApps user settings, user-app settings, and notifications | Become-AdminPowerAppsUserDetails |
Returns a list of app connexion references | Become-AdminPowerAppConnectionReferences |
Read & delete a user's Microsoft Menstruation settings, which are non visible to user, but that support catamenia execution | Get-AdminFlowUserDetails Remove-AdminFlowUserDetails |
Create, read, update & delete data loss prevention policies for your organization | Get-AdminDlpPolicy Add-AdminDlpPolicy Remove-AdminDlpPolicy Ready-AdminDlpPolicy Add-ConnectorToBusinessDataGroup Remove-ConnectorFromBusinessDataGroup |
Tips
- Use Go-Help 'CmdletName' to get a listing of examples.
- To cycle through the possible options for input tags, click on the tab key after typing out the nuance (-) character, after the cmdlet name.
Functioning examples
Below are some common scenarios that evidence how to utilize new and existing PowerApps cmdlets.
Environments Commands
Utilize these commands to get details on and update environments in your tenant.
Display a list of all environments
Get-AdminEnvironment
This returns a list of each surround beyond your tenant, with details of each (e.one thousand., environment proper noun (guid), display proper name, location, creator, etc).
Brandish details of your default surround
Get-AdminEnvironment –Default
Returns the details for only the default environment of the tenant.
Display details of a specific environment
Get-AdminEnvironment –EnvironmentName 'EnvironmentName'
Note: The EnvironmentName field is a unique identifier, which is dissimilar from the DisplayName (see first and second fields in the output in the following paradigm).
PowerApps Commands
These operations are used to read and change PowerApps data in your tenant.
Brandish a list of all PowerApps
Get-AdminPowerApp
Returns a list of all PowerApps across the tenant, with details of each (e.grand., application name (guid), display name, creator, etc).
Display a listing of all PowerApps that match the input display name
Get-AdminPowerApp 'DisplayName'
Returns a list of all the PowerApps in your tenant that match the display proper noun.
Note: Use quotation characters (") around input values that contain spaces.
Feature an awarding
Gear up-AdminPowerAppAsFeatured –AppName 'AppName'
Featured applications are grouped and pushed to the top of the listing in the PowerApps mobile player. Note: Like environments, the AppName field is a unique identifier, which is different from the DisplayName. If you lot desire to perform operations based on the display name, some functions volition let you use the pipeline (see adjacent function).
Make an awarding a Hero app, using the pipeline
Get-AdminPowerApp 'DisplayName' | Set-AdminPowerAppAsHero
A Hero app will appear at the height of the listing in the PowerApps mobile player. There tin can only be one Hero app. The pipeline (represented equally the '|' character between two cmdlets) takes the output of the first cmdlet and passes it as the input value of the second, assuming the function has been written to conform the pipeline feature. Note: an app must already exist a featured app before it is changed to a hero.
Display the number of apps each user owns
Become-AdminPowerApp | Select –ExpandProperty Owner | Select –ExpandProperty displayname | Group
You can combine native PowerShell functions with the PowerApps cmdlets to dispense data even further. Hither we utilize the Select office to isolate the Possessor attribute (an object) from the Get-AdminApp object. We then isolate the name of the possessor object by pipelining that output into another Select function. Finally, passing the second Select role output into the Group function returns a prissy table that includes a count of each owner'south number of apps.
Brandish the number of apps in each environs
Go-AdminPowerApp | Select -ExpandProperty EnvironmentName | Grouping | %{ New-Object -TypeName PSObject -Belongings @{ DisplayName = (Get-AdminPowerAppEnvironment -EnvironmentName $_.Name | Select -ExpandProperty displayName); Count = $_.Count } }
Download PowerApps user details
Get-AdminPowerAppsUserDetails -OutputFilePath '.\adminUserDetails.txt' –UserPrincipalName 'admin@bappartners.onmicrosoft.com'
The above command will store the PowerApps user details (basic usage data about the input user via their user principal proper name) in the specified text file. It will create a new file if at that place is no existing file with that proper name, and overwrite the text file if it already exists.
Set up logged in user equally the owner of a PowerApp
Set-AdminPowerAppOwner –AppName 'AppName' -AppOwner $Global:currentSession.userId –EnvironmentName 'EnvironmentName'
Changes the possessor role of a PowerApp to the current user, and replaces the original owner as a "can view" role blazon. Notation: The AppName and EnvironmentName fields are the unique identifiers (guids), not the brandish names.
Menstruation Commands
Use these commands to view and modify data related to Microsoft Flow.
Display all Flows
Go-AdminFlow
Returns a list of all flows in the tenant.
Display Period Owner Function details
Get-AdminFlowOwnerRole –EnvironmentName 'EnvironmentName' –FlowName 'FlowName'
Returns the owner details of the specified Flow. Annotation: Similar Environments and PowerApps, FlowName is the unique identifier (guid), which is different from the brandish proper name of the Menses.
Brandish Flow user details
Go-AdminFlowUserDetails –UserId $Global:currentSession.userId
Returns the user details regarding Catamenia usage. In this example nosotros're using the user Id of the current logged in user of the PowerShell session as input.
Remove Menstruum user details
Remove-AdminFlowUserDetails –UserId 'UserId'
Deletes the details on a Flow user completely from the Microsoft database. All Flows the input user owns must exist deleted before the Flow user details tin can be purged. Note: The UserId field is the Object ID of the user'southward Azure Active Directory record, which can exist constitute in the Azure Portal ( https://portal.azure.com) under Azure Active Directory > Users > Contour > Object ID. Must exist an admin to access this data from here.
Export all Flows to a CSV file
Become-AdminFlow | Export-Csv -Path '.\FlowExport.csv'
This command exports all the Flows in your tenant into a tabular view .csv file.
Api Connection Commands
View and manage API connections in your tenant.
Display all native Connections in your default environment
Become-AdminPowerAppEnvironment -Default | Get-AdminConnection
Displays a list of all Api Connections yous have in the default environment. Native connections are establish under the Data > Connections tab in the maker portal.
Display all Custom connectors in the tenant
Get-AdminPowerAppConnector
Returns a list of all custom connector details in the tenant.
Data Loss Prevention (DLP) Policy Commands
These cmdlets will control the DLP policies on your tenant.
Display all Policies
Get-AdminDlpPolicy
Returns a list of all the Policies.
Display a filtered listing of policies
Become-AdminDlpPolicy 'DisplayName'
Uses the display proper noun to filter the policies
Display all 'Business organization data only' Api connectors in a policy
Get-AdminDlpPolicy 'PolicyName' | Select –ExpandProperty BusinessDataGroup
Lists the Api connections that are in the Business concern data only (or BusinessDataGroup field) in an input policy.
Add a Connector to the 'Business data only' group
Add-ConnectorToBusinessDataGroup -PolicyName 'PolicyName' –ConnectorName 'ConnectorName'
Adds a connector to the 'Concern information merely' grouping in a given DLP policy. Run across the list of connectors by DisplayName and ConnectorName (used equally input) here.
Source: https://powerapps.microsoft.com/en-us/blog/gdpr-admin-powershell-cmdlets/
0 Response to "How To Change Owner Powershell For Powerautomate Application"
Post a Comment