Closed gischethans closed 3 years ago
add to S175
I'm facing this in Azure Public Cloud (North Europe). This appears intermittently and the operation succeeds in the next one or two attempts.
I've encountered the same error if I call az ad app create...
and then immediately call az ad sp create...
using the newly created app registration id.
I worked around it by pausing my script for 60 seconds in between the commands. It's a hack I've had to use in several other places in my infrastructure-as-code.
@gischethans, I previously commented at https://github.com/Azure/azure-cli/issues/14086#issuecomment-671685599 for this issue. It was also discussed at https://github.com/Azure/azure-cli/issues/7375#issuecomment-423410402.
This error message:
When using this permission, the backing application of the service principal being created must in the local tenant
is not the same as the public cloud's exception:
... does not reference ... ... does not exist ...
So it bypasses the retryable check:
I am considering maybe we can loose the check and also decrease
So that all kinds of exceptions can be retried. Just thinking...
@tejado, could you share the exception you are seeing? Is it the same as @gischethans's?
@ryanhofdotgov, it is expected that calling az ad sp create
immediately after az ad app create
may fail. Please see https://github.com/Azure/azure-cli/issues/14086#issuecomment-671685599 for an explanation and the retry logic.
Note, I'm seeing this on the public cloud.
today I experienced this issue on azure-cli 2.52.0
when calling az ad sp create
right after az ad app create
is it realistic that _RETRY_TIMES was exceeded?
This error message about tenant is a red herring.
The root cause is here: https://stackoverflow.com/questions/60004010/creating-service-principal-for-azure-cdn-is-failing-with-tenant-permission-error
In short, we need AAD Administrative Roles, not RBAC roles which are used for resources).
What if I'm using application permissions, how do I then fix the missing AAD administrative roles??
When creating a service principal in the Azure US Government Cloud (I did not face the issue with Azure Public Cloud) with Azure CLI, I see the error "When using this permission, the backing application of the service principal being created must in the local tenant". This appears intermittently and the operation succeeds in the next one or two attempts.
Command Name
az ad sp create-for-rbac
Errors:
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information. Run this command -
az ad sp create-for-rbac --name http://chethan1-sp --role Contributor --scopes /subscriptions/<subscription id>
The first attempt often resulted in the error shown above. The next attempt was mostly successful like below -
Expected Behavior
The service principal is created successfully.
Environment Summary
Additional Context