m365 flow list throws error "x-ms-client-scope header must not be null or empty"
See original GitHub issueHello,
I am trying to monitor my Power automate flows through a scheduled powershell script + m365 CLI. I use the following command which works perfectly with my user account:
m365 flow list --environment $environment --output json
Now I would like to use it through an app ID authentication (m365 login --secret). I made an app registration with access to Flow Service (Flow.Read.All as API permission).
I login succesfully but when I run the same command, I get the following error:
x-ms-client-scope header must not be null or empty
Behing the scene I guess the power automate API use delegated permissions. Is there a way to execute the m365 flow command without a user account ? I think of using a service account but if you have another thoughts, please help 😃. Or maybe there is something specific to configure within the app registration to make it work with m365 CLI ? I saw @VelinGeorgiev had the same issue a couple of years ago : https://github.com/pnp/cli-microsoft365/issues/1048 David
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Related StackOverflow Question
@milanholemans yeah we should catch this scenario and provide better feedback
Hi @David74000
Just checked, the API we are calling only supports delegated authentication. The error you are getting back is quite weird indeed, but I can confirm that you cannot send a request with application permissions. We need
Azure Service Managementpermissions which only support delegated authentication.Maybe it’s a good idea that we just throw an error when someone tries to run the command with application permissions like we do for Planner commands.