Skip to content
AZ-06 Draft

Azure deployment script fails partway

The three causes we see most often, and how to make the script fail loudly instead of quietly.

Draft. The fix is known and correct, but we're still writing up the full step-by-step.

Causes we’ve seen

  1. VM size unavailable in the region, or capacity restricted for the subscription. Check with Get-AzComputeResourceSku for the region.
  2. Resource providers not registered on a new subscription (for example Microsoft.Compute, Microsoft.Network, Microsoft.DesktopVirtualization). Register them with Register-AzResourceProvider.
  3. Later steps skipped silently, because the script stopped on the first error and the output scrolled away.

Make it fail loudly

  • Set $ErrorActionPreference = "Stop" and wrap each stage in try/catch that prints which stage failed.
  • Check prerequisites (providers, SKU availability, quota) before creating anything.
  • Make steps idempotent, so you can safely re-run the script after a fix.

This guide is being expanded with full steps.

Seeing this in your environment?

We can check for this, and everything around it, as part of an audit.

Ask us about AZ-06

Find out what's really going on in your tenant.

Tell us what you run and what's worrying you. We'll recommend the right audit, and tell you honestly if you don't need one.