question

srinathsarman-6473 avatar image
0 Votes"
srinathsarman-6473 asked azure-cxp-api edited

Unable to create a VM using azure power powershell

I am facing some issues while creating VM using Azure PowerShell where i could create and play around directly through portal. Below is the error i am getting. Comments are most welcome to rectify this and Thanks in Advance!

cmdlet New-AzVM at command pipeline position 1 Supply values for the following parameters: Name: test New-AzVM : Resource 'test' was disallowed by policy. Policy identifiers: '[{"policyAssignment":{"name":"Not allowed resource types","id":"/subscriptions/XXXXXXXXXXX/providers/Microsoft.Authorization/policyAssignment s/XXXXXXXXXX"},"policyDefinition":{"name":"Not allowed resource types","id":"/providers/Microsoft.Authorization/policyDefinitions/XXXXXXXX"}}]'. At line:1 char:1

New-AzVM
+ CategoryInfo : CloseError: (:) [New-AzVM], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

azure-virtual-machinesazure-policy
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered srinathsarman-6473 commented

Hi @srinathsarman-6473 ,

the error messages shows the following detail:

86114-image.png

It looks like resources with name "test" are not allowed by an Azure Policy of your organization.

If the name "test" is not allowed by your Azure Policies you should just try a different name for the resource.


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten


image.png (46.8 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the response @AndreasBaumgarten

Instead of "test" i tried with another name. Unfortunately its throwing same error

0 Votes 0 ·

Which name you tried?
Do you use "test" anywhere else in your PowerShell script?


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

0 Votes 0 ·

Below one is error i am getting

cmdlet New-AzVM at command pipeline position 1
Supply values for the following parameters:
Name: Saamaj
New-AzVM : Resource 'Saamaj' was disallowed by policy. Policy identifiers: '[{"policyAssignment":{"name":"Not allowed resource types","id":"/subscriptions/24793d47-f422-
4790-9b0b-b1733dac4ee1/providers/Microsoft.Authorization/policyAssignments/dc5f7d717eb64573a9c58d58"},"policyDefinition":{"name":"Not allowed resource
types","id":"/providers/Microsoft.Authorization/policyDefinitions/6c112d4e-5bc7-47ae-a041-ea2d9dccd749"}}]'.
At line:1 char:1
+ New-AzVM
+ ~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzVM], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

0 Votes 0 ·
VaibhavChaudhari avatar image
0 Votes"
VaibhavChaudhari answered

There is some policy defined on RG or maybe subscription in which, you are not allowed to create VM. Check for the policies or contact admin.


Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.