Az-104 Lab issue

I tried to run the script from git to perform lab in AZ-104. While executing the script in azure playground its showing its showing an access issue error. Can someone help to resolve this issue?

PS /home/odl_user> ./peering-pref-infra.ps1
New-AzResourceGroup: /home/odl_user/peering-pref-infra.ps1:17
Line |
17 | New-AzResourceGroup -n $rg -l $region
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Operation returned an invalid status code ‘Forbidden’ StatusCode: 403 ReasonPhrase: Forbidden OperationID : 1f2436d4-fa85-436e-ae25-71936b1271f5
Creating EUS VM
New-AzVM: /home/odl_user/peering-pref-infra.ps1:20
Line |
20 | New-AzVm | ~~~~~~~~~~ | The client '[email protected]' with object id 'e89e97cf-302d-4337-8635-6e0530fd30ea' does not have authorization to perform | action 'Microsoft.Compute/virtualMachines/read' over scope | '/subscriptions/1ca63aff-186a-4e2b-b3bc-f7dddf1d8969/resourceGroups/rg-vnet-peering-20240326/providers/Microsoft.Compute/virtualMachines/vm-eus' or the scope is | invalid. If access was recently granted, please refresh your credentials. Creating WUS VM New-AzVM: /home/odl_user/peering-pref-infra.ps1:35 Line | 35 | New-AzVm
| ~~~~~~~~~~
| The client ‘[email protected]’ with object id ‘e89e97cf-302d-4337-8635-6e0530fd30ea’ does not have authorization to perform
| action ‘Microsoft.Compute/virtualMachines/read’ over scope
| ‘/subscriptions/1ca63aff-186a-4e2b-b3bc-f7dddf1d8969/resourceGroups/rg-vnet-peering-20240326/providers/Microsoft.Compute/virtualMachines/vm-wus’ or the scope is
| invalid. If access was recently granted, please refresh your credentials.

It looks like you are trying to create a VM in the rg-vnet-peering resource group but I think Azure playgrounds only allow you to use the predefined ODL resource group.

Do you have a link to the lab please?

Thanks for the reply!!! I am trying to access the azure playground listed below:

Yes Azure playgrounds don’t have the access to create new resource groups. Do you have a link to what you are trying to deploy?

I am trying to deploy the below from the powershell-:

File-: peering-pref-infra.ps1

Change the line to match the resource group name that is already present in the Azure Portal.

Or you can change it to this:

$rg = (Get-AzResourceGroup).ResourceGroupName

Thanks for the quick resolution!!! It works!!! But now getting another error seems issue with the disk provisioning.

PS /home/odl_user> ./peering-pref-infra.ps1

Confirm
Provided resource group already exists. Are you sure you want to update it?
[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): y

ResourceGroupName : ODL-azure-1277447
Location : eastus
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/resourceGroups/ODL-azure-1277447

Creating EUS VM
New-AzVM: /home/odl_user/peering-pref-infra.ps1:20
Line |
20 | New-AzVm | ~~~~~~~~~~ | Long running operation failed with status 'Failed'. Additional Info:'Resource 'vm-eus_disk1_7cbd16b9f95649fe951695f5728c9bbf' was disallowed by policy. Policy | identifiers: | '[{"policyAssignment":{"name":"azure8922-1277447-PolicyDefinition-ODL-azure-1277447","id":"/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/resourceGroups/ODL-azure-1277447/providers/Microsoft.Authorization/policyAssignments/azure8922-1277447-PolicyDefinition-ODL-azure-1277447"},"policyDefinition":{"name":"azure8922-1277447-PolicyDefinition","id":"/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/providers/Microsoft.Authorization/policyDefinitions/azure8922-1277447-PolicyDefinition"}}]'. Target: '/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/resourceGroups/ODL-azure-1277447/providers/Microsoft.Compute/disks/vm-eus_disk1_7cbd16b9f95649fe951695f5728c9bbf'.' Creating WUS VM New-AzVM: /home/odl_user/peering-pref-infra.ps1:35 Line | 35 | New-AzVm
| ~~~~~~~~~~
| Long running operation failed with status ‘Failed’. Additional Info:‘Resource ‘vm-wus_disk1_c550e9fc58f14f97ad1280a3ebea4a6e’ was disallowed by policy. Policy
| identifiers:
| ‘[{“policyAssignment”:{“name”:“azure8922-1277447-PolicyDefinition-ODL-azure-1277447”,“id”:“/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/resourceGroups/ODL-azure-1277447/providers/Microsoft.Authorization/policyAssignments/azure8922-1277447-PolicyDefinition-ODL-azure-1277447”},“policyDefinition”:{“name”:“azure8922-1277447-PolicyDefinition”,“id”:“/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/providers/Microsoft.Authorization/policyDefinitions/azure8922-1277447-PolicyDefinition”}}]’. Target: ‘/subscriptions/02a1c77c-0965-4976-b13b-8c339752bbc9/resourceGroups/ODL-azure-1277447/providers/Microsoft.Compute/disks/vm-wus_disk1_c550e9fc58f14f97ad1280a3ebea4a6e’.’

Azure Playground does not support the Premium SSDs, you will need to define Standard SSD. I don’t think this script was created with the Azure Playground in mind.

You will have to create custom VM Config and attach that to the New-AzVM commandlet.

I will give a shot and try to create the things manually and appreciate your assistance. Thanks!!! :grinning: