Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: Calling Power Automate through ARM is no longer supported error when using m365 flow commands #5715

Closed
StevieBleeds opened this issue Dec 11, 2023 · 13 comments
Assignees
Labels
Milestone

Comments

@StevieBleeds
Copy link

Priority

(Urgent) I can't use the CLI

Description

I have a number of Power Automate reporting Functions and they've recently stopped working. Upon checking, it appears that when running the m365 flow list and/or get commands, the following error is thrown:

{"error":"Calling Power Automate through ARM is no longer supported. Please use \"https://api.flow.microsoft.com/\" instead."}
I've tried using Managed Identity and Username/Password authentication and the error persists.

Steps to reproduce

m365 login --authType identity
m365 flow list -e $environmentId -o json --asAdmin | ConvertTo-Json

Expected results

A list of flows within the specified environment

Actual results

{"error":"Calling Power Automate through ARM is no longer supported. Please use \"https://api.flow.microsoft.com/\" instead."}

Diagnostics

Executing command flow list with options {"options":{"environmentName":"ENVIRONMENT_ID","output":"json","asAdmin":true,"debug":true}}
Existing access token ACCESS_TOKEN still valid. Returning...
Request:
{
  "url": "https://management.azure.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/ENVIRONMENT_ID/flows?api-version=2016-11-01",
  "method": "get",
  "headers": {
    "Accept": "application/json;odata.metadata=none",
    "user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/7.2.0",
    "accept-encoding": "gzip, deflate",
    "X-ClientService-ClientTag": "M365CLI:7.2.0",
    "authorization": "Bearer ACCESS_TOKEN"
  },
  "responseType": "json",
  "decompress": true
}
Request error:
{
  "url": "https://management.azure.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/ENVIRONMENT_ID/flows?api-version=2016-11-01",
  "status": 400,
  "statusText": "Bad Request",
  "headers": {
    "cache-control": "no-store, no-cache",
    "content-length": "182",
    "content-type": "application/json; charset=utf-8",
    "x-ms-ratelimit-remaining-tenant-reads": "11999",
    "strict-transport-security": "max-age=31536000; includeSubDomains",
    "x-ms-islandgateway": "ga00000FM, GA0000001",
    "x-ms-request-id": "uksouth:e849dd7c-66d0-4f9a-bb18-adfdefa0be10",
    "x-ms-correlation-request-id": "bf21fc70-154a-4f40-a255-7ebc285abf7f",
    "x-ms-flow-mobile-ios-version": "3.0.421",
    "x-ms-flow-routing-request-id": "WESTEUROPE:20231211T202918Z:a4e2c349-d0d9-42b1-bddc-9b0546cbdab9",
    "server-timing": "x-ms-igw-upstream-headers;dur=5.0,x-ms-igw-req-overhead;dur=0.7",
    "x-content-type-options": "nosniff",
    "x-ms-service-request-id": "9013f127-07a5-4330-95f1-dab9bc0a35f7",
    "x-ms-correlation-id": "234d42d4-c30f-4135-b459-ab059468b236",
    "x-ms-activity-vector": "IN.01.IN.0H.00",
    "x-ms-routing-request-id": "WESTEUROPE:20231211T202918Z:bf21fc70-154a-4f40-a255-7ebc285abf7f",
    "date": "Mon, 11 Dec 2023 20:29:17 GMT",
    "connection": "close"
  },
  "error": {
    "error": {
      "code": "ArmEndpointDeprecatedForNewClients",
      "message": "Calling Power Automate through ARM is no longer supported. Please use \"https://api.flow.microsoft.com/\" instead."
    }
  }
}

Timings:
api: 335.485127ms
core: 53.906741ms
command: 345.551597ms
options: 0.2166ms
total: 401.473732ms
validation: 0.907797ms
{"error":"Calling Power Automate through ARM is no longer supported. Please use \"https://api.flow.microsoft.com/\" instead."}

CLI for Microsoft 365 version

7.2.0

nodejs version

16.16.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

No response

@Adam-it
Copy link
Contributor

Adam-it commented Dec 12, 2023

Thanks @StevieBleeds for raising the issue 👍.
Unfortunately, I wasn't able to reproduce it locally with my tenant
image

Maybe that is something new that is gradually being updated and my dev tenant didn't receive the memo yet 😉.
We will look into it ASAP.
@pnp/cli-for-microsoft-365-maintainers could someone else also check this locally and see if maybe someone else is having a similar problem?

BTW @StevieBleeds I think you do not need to specify -o json as this is the default output mode for every command.

@StevieBleeds
Copy link
Author

Thanks @Adam-it

@milanholemans
Copy link
Contributor

No problem at all here. Strange. In which region is your tenant located @StevieBleeds?

@appieschot are you aware of a change for this API?

@waldekmastykarz
Copy link
Member

I recall a conversation we had a while back about Power Platform deprecating the support for ARM-based APIs, starting with newer tenants. I wonder if this wouldn't be related. The ArmEndpointDeprecatedForNewClients error code would certainly indicate that. We should look into possible solutions to ensure that we keep supporting Power Platform with CLI for M365.

@StevieBleeds
Copy link
Author

No problem at all here. Strange. In which region is your tenant located @StevieBleeds?

@appieschot are you aware of a change for this API?

It's in UK South. Thanks again.

@cheungtsl
Copy link

We have similar issue. We are in Canada

m365 flow list --environmentName $flowEnvironment --asAdmin
node.exe : - Running command...
.\npm\m365.ps1:24 char:5

  • & "node$exe"  "$basedir/node_modules/@pnp/cli-microsoft365/dist/i ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (- Running command...:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

Error: Calling Power Automate through ARM is no longer supported. Please use "https://api.flow.microsoft.com/" instead.

@martinlingstuyl
Copy link
Contributor

I just did some checking @pnp/cli-for-microsoft-365-maintainers, we can replace the base URL with https://api.flow.microsoft.com.

As to auth, that doesn't work out of the box. I got it working when swapping the resource with management.azure.com.

if (resource === 'https://api.flow.microsoft.com') {
      resource = 'https://management.azure.com/';
}

I only checked m365 flow list and m365 flow environment list though.

@martinlingstuyl
Copy link
Contributor

Ok, I've pushed a fix for all the flow commands. Let's see if we can get this in as fast as possible.

@Adam-it
Copy link
Contributor

Adam-it commented Dec 17, 2023

@martinlingstuyl merged ✅. I checked locally and on my tenant it (still 😉) works as expected
@StevieBleeds could you give it a try with the last 7.3 beta release from today?

@StevieBleeds
Copy link
Author

@martinlingstuyl merged ✅. I checked locally and on my tenant it (still 😉) works as expected

@StevieBleeds could you give it a try with the last 7.3 beta release from today?

I have updated my Function with the Beta release and it seems to be working again! Thank you!

@martinlingstuyl
Copy link
Contributor

That's nice to hear!

@siddharth-vaghasia
Copy link
Contributor

thanks @martinlingstuyl for fix :) it also affected PnP.Powershell same way and I was able to fix it by taking your code's reference...!!

@martinlingstuyl
Copy link
Contributor

thanks @martinlingstuyl for fix :) it also affected PnP.Powershell same way and I was able to fix it by taking your code's reference...!!

Sharing is caring! 🙂🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants