I have a Web App in Azure with deployment slots. Application is placed in ASE. I need a service principal (App registration) in Azure AD that has permission to deploy to only a specific slot, not the whole Web App.
A service principal with "Contributor" role asignment was created for the TEST slot only. This service principal has no access to the whole web app, has no role there.
When deployment to the TEST slot the following error comes up:
az login --service-principal --username XXX-XXX-XXX-XXX-XXX --password ... --tenant XXX-XXX-XXX-XXX-XXX
az webapp deployment source config-zip --resource-group myresgroup --name mywebapp --src archive.zip --slot test
ERROR: AuthorizationFailed - The client 'XXX-XXX-XXX-XXX-XXX' with object id 'XXX-XXX-XXX-XXX-XXX'
does not have authorization to perform action 'Microsoft.Web/sites/publishxml/action'
over scope '/subscriptions/XXX-XXX-XXX-XXX-XXX/resourceGroups/myresgroup/providers/Microsoft.Web/sites/mywebapp'
or the scope is invalid.
If access was recently granted, please refresh your credentials.
Is it possible to give a permission for deployment to a specific slot only?