M365 CLI
Installation
Source: https://pnp.github.io/cli-microsoft365/cmd/docs/
Install m365 cli from: https://github.com/pnp/cli-microsoft365
Login into Microsoft:
You will be prompted to open a browser with this url https://microsoft.com/devicelogin Enter the code that prompt message indicates and login as m365 user.
Ennumeration techniques
Get information about the default Power Apps environment.
List Microsoft Power Apps environments in the current tenant
List all available apps for that user
List all apps in an environment as Admin
Remove an app
Removes the specified Power App without confirmation
Removes the specified Power App you don't own
m365 pa app remove --name 00000000-0000-0000-0000-000000000000 --environmentName Default- 00000000-0000-0000-0000-000000000000 --asAdmin
Add an owner without removing the old one
m365 pa app owner set --environmentName 00000000-0000-0000-0000-000000000000 --appName 00000000-0000-0000-0000-000000000000 --userId 00000000-0000-0000-0000-000000000000 --roleForOldAppOwner CanEdit
Export an app
m365 pa app export --environmentName 00000000-0000-0000-0000-000000000000 --name 00000000-0000-0000-0000-000000000000 --packageDisplayName "PowerApp" --packageDescription "Power App Description" --packageSourceEnvironment "Pentesting" --path ~/Documents