Hi again Ihsen,
I removed the circular dependency commenting this line of code in all your VMs (You can finf it: line 439, 514, 589):
// "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySets_myAvailabilitySet_name'))]",
You had had a circular dependency between the availability set and the VMs deployment before this commenting on the dependence. So You need to comment these line and try again.
Additional consideration before complete de deployment:
- Remember the names for some resources are unique such as: ihsentest.eastus.cloudapp.azure.com, You need to change before deploy again If it is still alive.
- This ARM template has many resources like VMs, NSG, Public, IP, etc. So here even that you can modify to make works this template it's recommend to organize the code in order have best practices: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/best-practices
- If you will deploy on Production I highly recommend to use Bicep if you want to continue learning Infrastructure as code on azure. https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/quickstart-create-bicep-use-visual-studio-code?tabs=CLI
Let me know if you have more doubts or problems (That ARM template require some modifications besides the initial error solved)
Luis
If the information helped address your question, please Accept the answer.