Hi team
Special invite to @EricRegnier (I have seen your fingerprint on other posts).
I have got Azure DevOps pipelines setup that does the following:
- Exports solution from source environment within Service Provider (Me) tenancy
- Uploads solution source files to Azure DevOps Repo
- Performs a Backup target environment(s) in Customer tenancy
- Imports solution in target environment(s) in Customer tenancy
This is enabled by:
- App Registration(s) / Service Principal(s) (1 per tenancy: 1 for Service Provider, 1 for Customer)
- Appropriate API Permissions and admin consent (Access Common Data Service as organization users & MS Graph)
- Environment App User (Referencing the App Registration)
- Azure DevOps Service Connection(s) (1 per environment and Referencing the App Registration)
- Have checked the configuration of this several times to ensure correct ID's for URL, tenant, App ID, Secret
- Environment specific settings file.json with environment variables and connection references
- I have also run a powershell command that gives the service principal same admin permissions as my admin account (not sure if this is just duplicating the Azure UI button in the app reg API permissions 'Grant admin consent'
This all works perfectly when exporting from Service Provider environment and importing to a Customer environment.
My issues is that when I try and export solution and import into a new test environment within my Service Provider tenancy, I get an XML error within the Import Solution Step:
<Message>Request failed with: Forbidden and error: {"error":{"code":"ConnectionAuthorizationFailed","message":"The caller with object id 'xxxx-xxxx-xxxx-xxxx' does not have the minimum required permission to perform the requested operation on connection 'xxxx-xxxx-xxxx-xxxx' under API 'shared_commondataserviceforapps'."}} and request url https://api.powerapps.com/providers/Microsoft.PowerApps/scopes/service/apis/shared_commondataserviceforapps/connections/xxxx-xxxx-xxxx-xxxx?api-version=2018-10-01&$expand=permissions($filter=maxAssignedTo('xxxx-xxxx-xxxx-xxxx')&$filter=environment eq 'xxxx-xxxx-xxxx-xxxx'</Message>
I do know that the API permissions on some level are working correctly because the preceding step of Backup Environment works successfully and so does a test Who Am I step.
Any assistance would be greatly appreciated as I have been driving myself crazy with this for over a week now.
Kind regards
Rob