Error on creating a Service Connection from Azure Devops to Portal subscription

Michael Sinoplis 20 Reputation points
2026-06-23T09:48:23.7266667+00:00

Failed to set Azure permission 'RoleAssignmentId: X' for the service principal 'X' on subscription ID 'X': error code: Unauthorized, inner error code: RequestDisallowedByAzure, inner error message Resource 'X' was disallowed by Azure: You are receiving this error because you tried to create, update or delete Azure resources without authenticating through MFA. User accounts must be authenticated through MFA to manage your resources. To resolve this error, go to https://aka.ms/MFAforAzure. Ensure that the user has 'Owner' or 'User Access Administrator' permissions on the Subscription.

We are Owner of the Subscription confirmed.

Azure DevOps

Answer accepted by question author
Christos Panagiotidis 3,551 Reputation points
2026-07-18T10:09:32.4366667+00:00

Owner is sufficient for the role assignment, but it does not satisfy MFA. RequestDisallowedByAzure means the user token Azure DevOps used for automatic setup did not contain a valid MFA claim.

Sign out of Azure DevOps and Azure, open a private browser session, sign in again, complete MFA, and retry. If Owner is eligible through PIM, reactivate it and complete MFA during activation. Your Entra administrator can confirm the request in the sign-in logs. Do not create an MFA exclusion; Azure's mandatory enforcement can ignore such exclusions for resource-management writes.

If automatic creation still fails, use a workload identity federation service connection. Have an authenticated administrator create an app registration or user-assigned managed identity, grant it the required Azure role at the narrowest scope, add the federated credential generated by Azure DevOps, then save and verify the connection. This avoids stored secrets and leaves MFA on human administrative actions.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Oldest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.