Skip to content

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:

m365 login  

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.

m365 pa environment get  

List Microsoft Power Apps environments in the current tenant

m365 pa environment list 

List all available apps for that user

m365 pa app list  

List all apps in an environment as Admin

m365 pa app list --environmentName 00000000-0000-0000-0000-000000000000 --asAdmin  

Remove an app

m365 pa app remove --name 00000000-0000-0000-0000-000000000000  

Removes the specified Power App without confirmation

m365 pa app remove --name 00000000-0000-0000-0000-000000000000 --force  

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
Last update: 2024-01-10
Created: January 10, 2024 22:09:40