Task 10: Key Vault
DOCUMENT CATEGORY: Runbook
SCOPE: Key Vault deployment
PURPOSE: Create centralized secret management for Azure Local infrastructure
MASTER REFERENCE: Microsoft Learn - Key Vault
Status: Active
Overview
This task creates the management Key Vault used to store deployment secrets (VPN shared keys, domain admin passwords, service account credentials) and certificates. All scripts that reference keyvault:// URIs in infrastructure.yml resolve secrets from this vault.
Execution Target: Azure-Only (control-plane API operation) Tab Profile: 3 tabs — Azure Portal · PowerShell · Azure CLI
Module: azurelocal-toolkit
File: key-vault.tf
Mode: Management
Components Created
| Resource | Name Pattern | Purpose |
|---|---|---|
| Key Vault | kv-{customer}-platform | Management secrets store |
Key Vault Configuration
| Setting | Value | Source |
|---|---|---|
| Name | Per config | key_vaults[].name |
| SKU | Standard | Fixed: the vaults hold secrets only (Microsoft Learn: Azure Key Vault service tiers) |
| Soft delete retention | 7 to 90 days, default 90 (the Azure default) | key_vaults[].soft_delete_retention_days |
| Purge protection | On, except when the environment class is lab, test or dev | scenario.environment_class |
| RBAC authorization | Enabled | Fixed: Azure RBAC, no access policies |
| Network access | Azure default (all networks); restrict it with your network design after the vault exists | Not set by the script |
Secrets to Populate
| Secret Name | Purpose | Config Path |
|---|---|---|
azlocal-admin-password | Azure Local node admin | a keyvault:// reference in the key that needs the secret |
recovery-admin-password | Recovery admin | a keyvault:// reference in the key that needs the secret |
vpn-shared-key | S2S VPN PSK | a keyvault:// reference in the key that needs the secret |
Prerequisites
- Resource group exists
- Key Vault Administrator or Contributor role
- Secrets values prepared (do NOT store in YAML — use Key Vault only)
Values from infrastructure.yml
The script reads these keys from infrastructure.yml (schema 5). Each key, with its type, default and example, is in the variables reference.
azure.tenant_id, azure.location, tags, scenario.environment_class
key_vaults[].name, .subscription_id, .resource_group, .purpose
every keyvault://<vault>/<secret> reference anywhere in the file (names only; no value is read)
The Terraform route (src/terraform/modules/identity, the platform Key Vault, key_vaults[] with purpose: management) also reads two keys added in registry 5.0.62 (schema 5.6.28, optional): key_vaults[].soft_delete_retention_days (days a deleted secret or the vault stays recoverable, 7 to 90, default 90) and key_vaults[].allowed_ip_ranges (public IP addresses or CIDR ranges that may reach the vault; empty keeps the Azure default, all networks).
Single Subscription Model
Landing Zone Placement
| Field | Value | Config Path |
|---|---|---|
| Subscription | Customer subscription | landing_zone.subscriptions[].id |
| Resource Group | rg-azrlmgmt-{env}-{region}-01 | key_vaults[].resource_group |
| Key Vault Name | Per config | key_vaults[].name |
Execution Options
- Azure Portal
- Orchestrated Script
- Azure CLI
Azure Portal
When to use: Learning Azure Local, single deployment, prefer visual interface
Procedure
- Create Key Vault:
- Search for Key vaults → + Create
| Field | Value | Source |
|-------|-------|--------|
| Name | Per config |
key_vaults[].name| | Subscription | Target subscription |landing_zone.subscriptions[].id| | Resource Group | Management RG |key_vaults[].resource_group| | Region | Your region |azure.location| | Pricing tier | Standard | — |
-
Access Configuration: | Field | Value | |-------|-------| | Permission model | Azure role-based access control (recommended) | | Resource access | Enable Azure Resource Manager for template deployment | | Resource access | Enable Azure Virtual Machines for deployment |
-
Networking: | Field | Value | |-------|-------| | Public access | All networks (required for Azure Local today) | | Allow trusted Microsoft services | Yes |
-
Review + create: Verify → Click Create
-
Add Secrets: For each secret in the table above:
- Key Vault → Secrets → + Generate/Import
- Set Name and Value for each secret
Validation
- Key Vault provisioning state: Succeeded
- RBAC authorization enabled
- All required secrets present
- Soft delete enabled
Links
PowerShell
When to use: Run the task from a management workstation or a pipeline. The script reads
infrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/02-azure-foundation/phase-04-azure-management-infrastructure/02-manual-deployment/task-10-key-vault/powershell/Deploy-KeyVaults.ps1 | Creates the Key Vaults that infrastructure.yml lists, and checks that the secrets the file refers to are there. Supports -WhatIf. |
Requires: PowerShell 7.
Run
./Deploy-KeyVaults.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
Azure CLI
When to use: Run the task from a host that has the Azure CLI and not the Az PowerShell modules. The script is PowerShell 7 that calls
az; it readsinfrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/02-azure-foundation/phase-04-azure-management-infrastructure/02-manual-deployment/task-10-key-vault/azurecli/Deploy-KeyVaults.azcli.ps1 | Creates the Key Vaults that infrastructure.yml lists, and checks that the secrets the file refers to are there, with the Azure CLI. Supports -WhatIf. |
Requires: PowerShell 7 and the Azure CLI, signed in with az login --tenant <azure.tenant_id>.
Each vault uses Azure RBAC for its data plane, has soft delete, and has purge protection unless scenario.environment_class is lab, test or dev (a missing value means production). The script never writes or reads a secret value: it lists the secret names of a vault to report which keyvault:// references are missing. Set a value with az keyvault secret set (Key Vault Secrets Officer), then run the script again. Network access is left at the Azure default.
Run
./Deploy-KeyVaults.azcli.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
./Deploy-KeyVaults.azcli.ps1 -InfrastructureFile ./infrastructure.yml
Validation
- Key Vault provisioned
- RBAC authorization enabled
- Soft delete and purge protection enabled
- All required secrets populated
CAF/WAF Landing Zone Model
In the CAF/WAF model, the management Key Vault is deployed in the Management subscription.
Landing Zone Placement
| Field | Value | Config Path |
|---|---|---|
| Subscription | Management subscription | landing_zone.subscriptions[].id |
| Resource Group | rg-azrlmgmt-{env}-{region}-01 | key_vaults[].resource_group |
| Key Vault Name | Per config | key_vaults[].name |
A separate cluster Key Vault exists in the Cluster resource group for cluster-specific secrets. That is part of Stage 14-15 (Cluster Deployment), not this task.
Execution Options
- Azure Portal
- Orchestrated Script
- Azure CLI
Azure Portal
Follow the same procedure as Single Subscription → Azure Portal, targeting the Management subscription.
Validation
- Key Vault in Management subscription
- Cross-subscription access works via RBAC
PowerShell
When to use: Run the task from a management workstation or a pipeline. The script reads
infrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/02-azure-foundation/phase-04-azure-management-infrastructure/02-manual-deployment/task-10-key-vault/powershell/Deploy-KeyVaults.ps1 | Creates the Key Vaults that infrastructure.yml lists, and checks that the secrets the file refers to are there. Supports -WhatIf. |
Requires: PowerShell 7.
Run
./Deploy-KeyVaults.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
Azure CLI
When to use: Run the task from a host that has the Azure CLI and not the Az PowerShell modules. The script is PowerShell 7 that calls
az; it readsinfrastructure.ymland carries no values of its own.
Script
| Script | What it does |
|---|---|
scripts/deploy/02-azure-foundation/phase-04-azure-management-infrastructure/02-manual-deployment/task-10-key-vault/azurecli/Deploy-KeyVaults.azcli.ps1 | Creates the Key Vaults that infrastructure.yml lists, and checks that the secrets the file refers to are there, with the Azure CLI. Supports -WhatIf. |
Requires: PowerShell 7 and the Azure CLI, signed in with az login --tenant <azure.tenant_id>.
Each vault uses Azure RBAC for its data plane, has soft delete, and has purge protection unless scenario.environment_class is lab, test or dev (a missing value means production). The script never writes or reads a secret value: it lists the secret names of a vault to report which keyvault:// references are missing. Set a value with az keyvault secret set (Key Vault Secrets Officer), then run the script again. Network access is left at the Azure default.
Run
./Deploy-KeyVaults.azcli.ps1 -InfrastructureFile ./infrastructure.yml -WhatIf
./Deploy-KeyVaults.azcli.ps1 -InfrastructureFile ./infrastructure.yml
Validation
- Key Vault in Management subscription
- RBAC assignments for operators in other subscriptions
Troubleshooting
| Issue | Root Cause | Remediation |
|---|---|---|
| Name already taken | Key Vault names globally unique | Choose different name or recover soft-deleted vault |
| Soft-deleted vault blocks creation | Same name in deleted state | Purge: Remove-AzKeyVault -VaultName $name -InRemovedState -Location $location |
| Cannot access secrets | Missing RBAC role | Assign Key Vault Secrets User or Key Vault Administrator |
| Network access denied | Firewall blocking | Add client IP to network ACLs or use Azure Services bypass |
| Purge protection cannot be disabled | By design — irreversible | Plan purge protection before creation |
Alternatives
The procedures in this task use the methods shown in the tabs above. The toolkit is PowerShell 7 only and has no Bash scripts. A few tasks that act on Azure also have an Azure CLI script written in PowerShell. The script status page of the toolkit lists which task has which script.
Navigation
| Previous | Up | Next |
|---|---|---|
| Task 09: Log Analytics | Manual Deployment Index | Task 11: Deploy Management VMs |
Version Control
- Created: 2025-09-15 by Hybrid Cloud Solutions
- Last Updated: 2026-03-03 by Hybrid Cloud Solutions
- Version: 4.0.0
- Tags: azure-local, key-vault, security, secrets
- Keywords: Key Vault, secrets, certificates, credentials, RBAC, soft delete
- Author: Hybrid Cloud Solutions
Version Control
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0.0 | 2025-03-25 | Azure Local Cloud | Initial release |