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: Unable to export the specified Power App using 'm365 pa app export' command #5374

Closed
Saurabh7019 opened this issue Aug 3, 2023 · 4 comments
Assignees
Milestone

Comments

@Saurabh7019
Copy link
Contributor

Priority

(Low) Something is a little off

Description

I'm trying to use the m365 pa app export command to export a Power App from my environment. However, I'm encountering an error during execution.

Steps to reproduce

Execute the below command:

m365 pa app export --environment <The name of the environment for which to export the app> --id <The id of the Power App to export>

Expected results

m365 pa app export command should successfully export the specified Power App.

Actual results

the command throws the below error:

Error: invalid_resource: 500011 - [2023-08-03 11:24:38Z]: AADSTS500011: The resource principal named https://europe.api.bap.microsoft.com was not found in the tenant named contoso. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Trace ID: 112ad253-9baf-46e0-8c27-375ac1356600
Correlation ID: 8570a874-70d4-4884-9da8-0114a915d60a
Timestamp: 2023-08-03 11:24:38Z - Correlation ID: 8570a874-70d4-4884-9da8-0114a915d60a - Trace ID: 112ad253-9baf-46e0-8c27-375ac1356600

Diagnostics

Executing command pa app export with options {"options":{"environment":"a64000ef-f89e-e136-9ed2-e447a279364c","id":"6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d","debug":true,"output":"json"}}
Initiating package export for Microsoft Power App 6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d...
Getting the Microsoft Power App resources...
Existing access token still valid. Returning...
Request:
{
"url": "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/a64000ef-f89e-e136-9ed2-e447a279364c/listPackageResources?api-version=2016-11-01",
"method": "post",
"headers": {
"common": {
"Accept": "application/json, text/plain, /"
},
"delete": {},
"get": {},
"head": {},
"post": {
"Content-Type": "application/x-www-form-urlencoded"
},
"put": {
"Content-Type": "application/x-www-form-urlencoded"
},
"patch": {
"Content-Type": "application/x-www-form-urlencoded"
},
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/6.11.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:6.11.0",
"accept": "application/json",
"authorization": "Bearer "
},
"responseType": "json",
"decompress": true,
"data": {
"baseResourceIds": [
"/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d"
]
}
}
Response:
{
"url": "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/a64000ef-f89e-e136-9ed2-e447a279364c/listPackageResources?api-version=2016-11-01",
"status": 200,
"statusText": "OK",
"headers": {
"cache-control": "no-store, no-cache",
"content-length": "512",
"content-type": "application/json; charset=utf-8",
"strict-transport-security": "max-age=15724800; includeSubDomains",
"x-ms-islandgateway": "GA0000001, GA0000004",
"x-ms-request-id": "westeurope:f54483ff-b54f-40d4-9bfe-65235e87daa1",
"x-ms-correlation-request-id": "141f6497-7d65-4d8f-aedd-a8caad106049",
"x-ms-correlation-id": "141f6497-7d65-4d8f-aedd-a8caad106049",
"server-timing": "x-ms-igw-upstream-headers;dur=70.2,x-ms-igw-req-overhead;dur=0.7",
"x-content-type-options": "nosniff",
"x-ms-service-request-id": "f8019f9b-52ba-4954-9d7e-01295f77ba86",
"x-ms-activity-vector": "00.00.00.IN.03.00",
"x-cache": "CONFIG_NOCACHE",
"x-azure-ref": "0ZfPLZAAAAACXeXxx2fU+Sq+C3Undq4U+U1RPRURHRTE5MDkAZjYwNjhmZDgtNmRlZC00ZDYzLThkZGYtMjg3MWJiYjU2NTYw",
"x-ms-destination-geo": "europe",
"date": "Thu, 03 Aug 2023 18:35:16 GMT",
"connection": "close"
},
"data": {
"status": "Succeeded",
"baseResourceIds": [
"/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d"
],
"resources": {
"L1BST1ZJREVSUy9NSUNST1NPRlQuUE9XRVJBUFBTL0FQUFMvNkQ1QzRDMzItNkE2Qy00RDJGLTg3QjAtQTEwQjY4OTQyQjRE": {
"id": "/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"name": "6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"type": "Microsoft.PowerApps/apps",
"creationType": "New, Update",
"details": {
"displayName": "temp"
},
"configurableBy": "User",
"hierarchy": "Root",
"dependsOn": []
}
}
}
}
Existing access token still valid. Returning...
Request:
{
"url": "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/a64000ef-f89e-e136-9ed2-e447a279364c/exportPackage?api-version=2016-11-01",
"method": "post",
"headers": {
"common": {
"Accept": "application/json, text/plain, /"
},
"delete": {},
"get": {},
"head": {},
"post": {
"Content-Type": "application/x-www-form-urlencoded"
},
"put": {
"Content-Type": "application/x-www-form-urlencoded"
},
"patch": {
"Content-Type": "application/x-www-form-urlencoded"
},
"user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/6.11.0",
"accept-encoding": "gzip, deflate",
"X-ClientService-ClientTag": "M365CLI:6.11.0",
"accept": "application/json",
"authorization": "Bearer "
},
"responseType": "json",
"decompress": true,
"data": {
"includedResourceIds": [
"/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d"
],
"details": {},
"resources": {
"L1BST1ZJREVSUy9NSUNST1NPRlQuUE9XRVJBUFBTL0FQUFMvNkQ1QzRDMzItNkE2Qy00RDJGLTg3QjAtQTEwQjY4OTQyQjRE": {
"id": "/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"name": "6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"type": "Microsoft.PowerApps/apps",
"creationType": "New, Update",
"details": {
"displayName": "temp"
},
"configurableBy": "User",
"hierarchy": "Root",
"dependsOn": [],
"suggestedCreationType": "Update"
}
}
}
}
Response:
{
"url": "https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/a64000ef-f89e-e136-9ed2-e447a279364c/exportPackage?api-version=2016-11-01",
"status": 202,
"statusText": "Accepted",
"headers": {
"cache-control": "no-store, no-cache",
"content-length": "479",
"content-type": "application/json; charset=utf-8",
"location": "https://europe.api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/a64000ef-f89e-e136-9ed2-e447a279364c/packagingOperations/85b0db8f-711c-4830-840f-dd62b253bd32?api-version=2016-11-01",
"retry-after": "10",
"strict-transport-security": "max-age=15724800; includeSubDomains",
"x-ms-islandgateway": "GA0000002, ga000006U",
"x-ms-request-id": "westeurope:c00c92cd-5efc-47e2-bb0f-2953a4284899",
"x-ms-correlation-request-id": "0365290e-6471-4638-96c0-556366afb2d3",
"x-ms-correlation-id": "0365290e-6471-4638-96c0-556366afb2d3",
"server-timing": "x-ms-igw-upstream-headers;dur=239.2,x-ms-igw-req-overhead;dur=0.4",
"x-content-type-options": "nosniff",
"x-ms-service-request-id": "dc009793-4973-4b77-8bce-ecd5a6772780",
"x-ms-activity-vector": "00.00.00.IN.03.00",
"x-cache": "CONFIG_NOCACHE",
"x-azure-ref": "0ZfPLZAAAAADt+ah4zw27QI7EfpVFqYyhU1RPRURHRTEzMjAAZjYwNjhmZDgtNmRlZC00ZDYzLThkZGYtMjg3MWJiYjU2NTYw",
"x-ms-destination-geo": "europe",
"date": "Thu, 03 Aug 2023 18:35:17 GMT",
"connection": "close"
},
"data": {
"status": "Running",
"details": {
"packageTelemetryId": "ca376e3c-7719-46c0-a738-362e09b39dbd"
},
"resources": {
"ee826709-8a90-43df-8f03-741d203fe924": {
"id": "/providers/Microsoft.PowerApps/apps/6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"name": "6d5c4c32-6a6c-4d2f-87b0-a10b68942b4d",
"type": "Microsoft.PowerApps/apps",
"status": "Running",
"suggestedCreationType": "Update",
"creationType": "New, Update",
"details": {
"displayName": "temp"
},
"configurableBy": "User",
"hierarchy": "Root",
"dependsOn": []
}
}
}
}
Retrieving the package link and waiting on the exported package.
No token found for resource https://europe.api.bap.microsoft.com
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Info - getTokenCache called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getIdToken - No token found
Retrieving new access token silently
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Info - getTokenCache called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getIdToken - No token found
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - initializeRequestScopes called
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-node@1.17.2 : Verbose - buildOauthClientConfiguration called
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-node@1.17.2 : Verbose - building oauth client configuration with the authority: https://login.microsoftonline.com/common
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-node@1.17.2 : Verbose - createAuthority called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - Attempting to get cloud discovery metadata in the config
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-node@1.17.2 : Verbose - cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-node@1.17.2 : Verbose - Silent flow client created
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getIdToken - Returning id token
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getAccessToken - No token found
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getRefreshToken - returning refresh token
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-common@13.0.0 : Info - SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-common@13.0.0 : Verbose - RefreshTokenClientAcquireTokenWithCachedRefreshToken called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/msal-common@13.0.0 : Info - CacheManager:getRefreshToken - returning refresh token
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/msal-common@13.0.0 : Verbose - RefreshTokenClientAcquireToken called
Error: invalid_resource: 500011 - [2023-08-03 18:35:18Z]: AADSTS500011: The resource principal named https://europe.api.bap.microsoft.com was not found in the tenant named contoso. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Trace ID: 13339811-82ad-4447-acc2-4684723a4300
Correlation ID: 4ce46f2b-0ced-4a34-a353-3cbb710a57e0
Timestamp: 2023-08-03 18:35:18Z - Correlation ID: 4ce46f2b-0ced-4a34-a353-3cbb710a57e0 - Trace ID: 13339811-82ad-4447-acc2-4684723a4300

CLI for Microsoft 365 version

v6.11.0

nodejs version

v18.16.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

{
"os": {
"platform": "win32",
"version": "Windows 10 Enterprise",
"release": "10.0.22000"
},
"cliVersion": "6.11.0",
"nodeVersion": "v18.16.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "Browser",
"cliEnvironment": "",
"cliConfig": {},
"roles": [],
"scopes": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"ChannelMember.ReadWrite.All",
"ChannelMessage.Read.All",
"ChannelMessage.Send",
"ChannelSettings.ReadWrite.All",
"Chat.Read",
"Chat.ReadWrite",
"Directory.AccessAsUser.All",
"Directory.ReadWrite.All",
"ExternalConnection.ReadWrite.All",
"Group.ReadWrite.All",
"IdentityProvider.ReadWrite.All",
"InformationProtectionPolicy.Read",
"Mail.Read.Shared",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"OnlineMeetingTranscript.Read.All",
"Place.Read.All",
"Policy.Read.All",
"RecordsManagement.ReadWrite.All",
"Reports.Read.All",
"SecurityEvents.Read.All",
"ServiceHealth.Read.All",
"ServiceMessage.Read.All",
"ServiceMessageViewpoint.Write",
"Tasks.ReadWrite",
"Team.Create",
"TeamMember.ReadWrite.All",
"TeamsAppInstallation.ReadWriteForUser",
"TeamSettings.ReadWrite.All",
"TeamsTab.ReadWrite.All",
"TermStore.ReadWrite.All",
"User.Invite.All",
"User.Read.All",
"User.ReadWrite.All",
"profile",
"openid",
"email",
"User"
]
}

Additional Info

No response

@Saurabh7019 Saurabh7019 added the bug label Aug 3, 2023
@milanholemans
Copy link
Contributor

Thank you for logging this issue @Saurabh7019.
At first sight, I guess this might be the culprit:

if (resource === 'https://api.bap.microsoft.com' ||
resource === 'https://api.powerapps.com') {
resource = 'https://service.powerapps.com/';
}

Maybe if we add https://europe.api.bap.microsoft.com (and probably other regions) to this condition, the issue might be resolved.

Do you want to work on it, or should we open it up for the community?

@Saurabh7019
Copy link
Contributor Author

Sure, I can work on it. Shall I do it as part of #5368?

@martinlingstuyl
Copy link
Contributor

Sure, I can work on it. Shall I do it as part of #5368?

No, let's keep this work separate, @Saurabh7019, that will help us to not to let bugfix PR's get blocked because of other PR's.

@milanholemans
Copy link
Contributor

Like @martinlingstuyl said let's keep it separate indeed. This is a bug that should be fixed ASAP and should be merged with our main branch so it's fixed in our next release.

The rename of the option will be merged with our v7 branch and will be released within a few months (probably September/October).

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

Successfully merging a pull request may close this issue.

4 participants