tester81
tester81

Reputation: 595

Manage azure cloud via PowerShell - access problem

In my Azure environment I have MFA configured (MFA enabled using Security Default in Azure AD). I want to connect to Azure using Azure Powershell. I am using cmdlet

Connect-AzAccount -Subscription "SubscriptionID"

I have a Global Administrator role in Azure AD, and Owner role on the subscription level. Before MFA I was able to Connect-AzAccount without any problems. Now when I am trying to Connect-AzAccount I am getting information:

WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXCCAADDFF to authenticate.

I do recommended steps, using provided link providing code. After around 20 seconds I am getting an error message in the PowerShell console

Connect-AzAccount: The provided account [email protected] does not have access to subscription ID "SubscriptionID". Please try logging in with different credentials or a different subscription ID.

Upvotes: 1

Views: 798

Answers (1)

Hury Shen
Hury Shen

Reputation: 15734

The code XXCCAADDFF mentioned in warning message refers to device code, it may be caused by you enable device login.

You mentioned getting error message The provided account [email protected] does not have access to subscription ID...., you can use

Connect-AzAccount -TenantId <tenantId> -Subscription <subscriptionId>

instead of

Connect-AzAccount -Subscription <subscriptionId>

For this problem, here is a post related to it. I also test it in my side, just add -TenantId, it will solve the error message.

Upvotes: 1

Related Questions