i am not able to create resource group from azure powershell but able to create from Web portal

Chittajallu, Mohan Krishna 0 Reputation points
2024-10-08T01:57:17.99+00:00

i am using visual studio subscription in azure portal to create a resource group.

i am able to create from web portal but not from powershell cmd, which gives the below error message .

i am the owner of the subscription, not sure what is the issue

New-AzResourceGroup: Operation returned an invalid status code 'Forbidden'

StatusCode: 403

ReasonPhrase: Forbidden

OperationID : 5d438892-4288-4483-9d0b-46c59c5d3842

Azure Resource Mover
Azure Resource Mover
An Azure service used for moving multiple resources between Azure regions.
235 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vinodh247 22,951 Reputation points MVP
    2024-10-09T00:42:14.6066667+00:00

    Hi Chittajallu, Mohan Krishna,

    Thanks for reaching out to Microsoft Q&A.

    • Ensure your account has the correct role assignment (Owner or Contributor) for the subscription in Azure, as this might vary across different tools. Check your role in subs using the code below:
      • Get-AzRoleAssignment -Scope "/subscriptions/<SubscriptionID>" -PrincipalName "<YourEmail>"
    • Ensure that the required resource providers are registered in your subscription. Sometimes, certain providers (like Microsoft.Resources) need to be manually registered, if not registered do it useing:
      • Register-AzResourceProvider -ProviderNamespace Microsoft.Resources
    • There could be an issue with the token you are using in PowerShell being expired or not properly refreshed, try re-authenticating.
    • There could be an Azure Policy or management group rule restricting actions via certain methods (like PowerShell) but allowing actions via the portal. You can check if any policies are being enforced:
        Get-AzPolicyAssignment 
      
    • Ensure that you are not hitting any subscription or resource group creation limits, although this would usually result in a different error code.
    • If you're using a Visual Studio subscription, permissions or policies specific to this subscription might apply differently. Double-check the permissions specific to the Visual Studio subscription for your account.

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    1 person found this answer helpful.
    0 comments No comments

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.