Skip to content

Bug report: Unable to export the specified Power App using 'm365 pa app export' command #5374

@Saurabh7019

Description

@Saurabh7019

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/[email protected] : Info - getTokenCache called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getIdToken - No token found
Retrieving new access token silently
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - getTokenCache called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getIdToken - No token found
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Verbose - initializeRequestScopes called
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/[email protected] : Verbose - buildOauthClientConfiguration called
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/[email protected] : 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/[email protected] : Verbose - createAuthority called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Verbose - Attempting to get cloud discovery metadata in the config
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : 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/[email protected] : 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/[email protected] : 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/[email protected] : Verbose - cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/[email protected] : Verbose - Silent flow client created
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getIdToken - Returning id token
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getAccessToken - No token found
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getRefreshToken - returning refresh token
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/[email protected] : 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/[email protected] : Verbose - RefreshTokenClientAcquireTokenWithCachedRefreshToken called
[Thu, 03 Aug 2023 18:35:17 GMT] : @azure/[email protected] : Info - CacheManager:getRefreshToken - returning refresh token
[Thu, 03 Aug 2023 18:35:17 GMT] : [353cb164-3ff8-4d45-83ea-24504817e32a] : @azure/[email protected] : 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions