Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

virtual machine

Narendra_78

Customer
Customer
When i am trying to create a virtual machine in my practice lab (followed lab instruction while create VM) i am always end up with

{"code":"InvalidTemplateDeployment","message":"The template deployment failed because of policy violation. Please see details for more information.","details":[{"code":"RequestDisallowedByPolicy","target":"virtualvm1","message":"Resource 'virtualvm1' was disallowed by policy. (Code: RequestDisallowedByPolicy)","additionalInfo":[{"type":"PolicyViolation","info":{"policyDefinitionDisplayName":"Simplilearn_Azure_Lab_Custom_Policy","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/virtualMachines/sku.name","path":"properties.hardwareProfile.vmSize","expressionValue":"Standard_B1s","targetValue":"True","operator":"Exists"},{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/imageOffer","path":"properties.storageProfile.imageReference.offer","expressionValue":"WindowsServer","targetValue":"True","operator":"Exists"},{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/imageSku","path":"properties.storageProfile.imageReference.sku","expressionValue":"2016-Datacenter-smalldisk","targetValue":"True","operator":"Exists"},{"result":"False","expressionKind":"Field","expression":"Microsoft.Compute/imageSku","path":"properties.storageProfile.imageReference.sku","expressionValue":"2016-Datacenter-smalldisk","targetValue":["16.04-LTS","17.10","14.04.5-LTS","18.04-LTS","2016-Datacenter","2016-Datacenter-Server-Core","2016-Datacenter-with-Containers","2019-Datacenter"],"operator":"In"}]},"policyDefinitionId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyDefinitions/18d4a87b-328d-40fd-aed8-0a5a0c8a0246","policyDefinitionName":"18d4a87b-328d-40fd-aed8-0a5a0c8a0246","policyDefinitionEffect":"deny","policyAssignmentId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyAssignments/129c65dcb7fb4003915c928b","policyAssignmentName":"129c65dcb7fb4003915c928b","policyAssignmentDisplayName":"Simplilearn_Azure_Lab_Custom_Policy","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification","policyAssignmentParameters":{}}},{"type":"PolicyViolation","info":{"policyDefinitionDisplayName":"Simplilearn_Azure_Lab_Custom_Policy","evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/virtualMachines/sku.name","path":"properties.hardwareProfile.vmSize","expressionValue":"Standard_B1s","targetValue":"True","operator":"Exists"},{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/imageOffer","path":"properties.storageProfile.imageReference.offer","expressionValue":"WindowsServer","targetValue":"True","operator":"Exists"},{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/virtualMachines","targetValue":"Microsoft.Compute/virtualMachines","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/imageSku","path":"properties.storageProfile.imageReference.sku","expressionValue":"2016-Datacenter-smalldisk","targetValue":"True","operator":"Exists"},{"result":"False","expressionKind":"Field","expression":"Microsoft.Compute/imageSku","path":"properties.storageProfile.imageReference.sku","expressionValue":"2016-Datacenter-smalldisk","targetValue":["16.04-LTS","17.10","14.04.5-LTS","18.04-LTS","2016-Datacenter","2016-Datacenter-Server-Core","2016-Datacenter-with-Containers","2019-Datacenter"],"operator":"In"}]},"policyDefinitionId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyDefinitions/18d4a87b-328d-40fd-aed8-0a5a0c8a0246","policyDefinitionName":"18d4a87b-328d-40fd-aed8-0a5a0c8a0246","policyDefinitionEffect":"deny","policyAssignmentId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyAssignments/15d96ea072ec42f682b5b3a4","policyAssignmentName":"15d96ea072ec42f682b5b3a4","policyAssignmentDisplayName":"Simplilearn_Azure_Lab_Custom_Policy","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification","policyAssignmentParameters":{}}}],"policyDetails":[{"isInitiative":false,"assignmentId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyAssignments/129c65dcb7fb4003915c928b","assignmentName":"Simplilearn_Azure_Lab_Custom_Policy","nonComplianceMessage":null,"viewDetailsUri":"https://portal.azure.com#blade/Micr...on/policyAssignments/129c65dcb7fb4003915c928b"},{"isInitiative":false,"assignmentId":"/providers/Microsoft.Management/managementGroups/CS-Azure-Generic-Certification/providers/Microsoft.Authorization/policyAssignments/15d96ea072ec42f682b5b3a4","assignmentName":"Simplilearn_Azure_Lab_Custom_Policy","nonComplianceMessage":null,"viewDetailsUri":"https://portal.azure.com#blade/Micr...on/policyAssignments/15d96ea072ec42f682b5b3a4"}]}]}
 

Ruanne Fung Ucanan

Member
Alumni
A good way to check what is failing in your ARM template, would be that you try the same config in the portal, create your vm there manually, and then download the ARM template for that vm (look for Export template menu), so you can compare what is wrong
 

Narendra_78

Customer
Customer
Thanks for reply. Problem was sorted out. I miss red the test lab policy and selected wrong resource while create VM.
 
Top