MigrationPrerequisites Error The provided account X does not have access to subscription ID "Y"

Timothy Chin 0 Reputation points
2025-01-03T19:22:56.77+00:00

Connect-AzAccount : The provided account X does not have access to subscription ID "Y".

Please try logging in with different credentials or a different subscription ID.

If a subscription is not specified, please check the configs by Get-AzConfig.

At line:3411 char:14 + ... azConnect = Connect-AzAccount -Identity -AccountId $UserManagedServic ...

  • 
    

PSInvalidOperationException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

How to assign the automation account X to has access to subscription ID Y

Thank you.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,291 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ashok Gandhi Kotnana 2,500 Reputation points Microsoft Vendor
    2025-01-06T05:40:59.69+00:00

    Hi @Timothy Chin,

    Welcome to Microsoft Q&A Forum, thank you for posting your query here!

    1. Please enable the managed identity, once you have enabled the managed identity, please select permissions below highlighted User's image
    2. Click on Add role Assignment and add
      1. Scope: Subscription Subscription: Select Y Subscription Role: Owner or Contributor depends upon your script
      User's image let us know if you have any further queries. I’m happy to assist you further.   User's image Please do not forget to "Accept the answer” wherever the information provided helps you, this can be beneficial to other community members.

Your answer

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