Skip to content

Repository files navigation

Azure Scripts

Use these scripts to validate your environment and explore Azure region data. Run them from the repo root or from the PowerShell folder with PowerShell 7.2+.

Prerequisites

  • PowerShell 7.2 or later (pwsh --version)
  • Modules: Az.Accounts, Az.Resources (install with Install-Module -Name Az -Scope CurrentUser)
  • For Excel export (-ExportToExcel flags): ImportExcel module (install with Install-Module -Name ImportExcel -Scope CurrentUser)
  • Azure sign-in required for region/provider scripts (Connect-AzAccount)
  • Internet access for the Azure Retail Prices API (Compare-Pricing)

Quick Start: Validate Your Setup

  1. From the repo root:
    pwsh -ExecutionPolicy Bypass -File PowerShell/Validate-Setup.ps1
  2. The script checks:
    • PowerShell version (needs 7.2+)
    • Required Az modules
    • Azure sign-in and active subscription
    • Connectivity to the Retail Prices API (used by Compare-Pricing)
  3. Results are labeled PASS/WARN/FAIL. Resolve any FAIL items, then re-run until all required checks pass.

Script Guide

  • Validate-Setup.ps1: Verifies prerequisites for all scripts.
  • Get-TargetRegions.ps1: Compares registered resource providers in a source region against one or more target regions.
    • Example:
      pwsh -ExecutionPolicy Bypass -File PowerShell/Get-TargetRegions.ps1 -SourceRegion eastus -TargetRegions westus2,northeurope
    • Add -ExportToExcel to save summary/missing providers to Excel.
  • Get-ZoneMapping.ps1: Lists logical-to-physical availability zone mappings per region for the active subscription, with region metadata.
    • Example:
      pwsh -ExecutionPolicy Bypass -File PowerShell/Get-ZoneMapping.ps1
    • Add -ExportToExcel to save results (all/recommended/other) to Excel.
  • Compare-Pricing.ps1: Pulls VM pricing via the Azure Retail Prices API and builds a region-vs-VM-size comparison table (optionally exports to Excel).
    • Example (specific sizes and regions):
      pwsh -ExecutionPolicy Bypass -File PowerShell/Compare-Pricing.ps1 -VMSizes Standard_B1s,Standard_D2s_v3 -Regions eastus,westus2
    • Add -ExportToExcel to save results beside the script.

Notes

  • Run Connect-AzAccount first for region/provider scripts to avoid prompts.
  • Some scripts cache API results during the session or on disk to speed up reruns; you can opt out when prompted.
  • If your organization restricts script execution, include -ExecutionPolicy Bypass as shown in the examples.

About

Scripts for working with Microsoft Azure

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages