Issues in Exercise–Create an NVA and virtual machines
- Posted in:
- Azure
If you are learning AZ-303, and changes are you will encounter the same error when following the Exercise – Create an NVA and virtual machines (unit 5-7) by the time i’m writing this document (11/07/2021).
I have reported this issue with the Exercise, but it might not be fixed anytime soon. so just in case you need help with completing your Exercise. I tried to document the issue in Exercise, and the solution how you can resolve them.
What’s the issue
The requirement is to create vnent with 3 subnets
- 10.0.0.0/24
- 10.0.1.0/24
- 10.0.2.0/24
in Unit 5 of 7 , it provides the code as below for creating the 1st VM in subnet dmzsubnet. The problem with the below command is it doesn’t specify the subnet address prefix, therefor by default, it will be 10.0.0.24. You won’t yet get any error at this stage, as it’s the first subnet. Although it’s already not matching the design.
You will then get an error when you are following the Exercise along the way in Unit 6 of 7 with below code. you can’t create subnet with conflict address.
What’s the Solution
Adding “--subnet-address-prefix” when you create VMs. There are more optional parameters for creating VM you can find here.
here is the example code you can use
az vm create \
--resource-group learn-4bd2e66c-7759-446c-9a49-071b27237a7f \
--name public \
--vnet-name vnet \
--subnet publicsubnet \
--image UbuntuLTS \
--admin-username azureuser \
--no-wait \
--custom-data cloud-init.txt \
--subnet-address-prefix 10.0.2.0/24 \
--admin-password <changeme123>