Azure Key Vault collector setup
Use this page when a local collector will read Azure Key Vault. For scans without an installed agent, follow hosted Azure connection setup. The hosted connection uses application federation; a local collector uses an identity already available on its host. Do not mix their authentication steps.
One-command Python connection
Save agent.local.json from Getting started in the verified bundle folder and
configure the local cloud identity and read permissions first. Open a terminal in
that folder. On Windows, run:
py -3.12 scanner/setup_cloud.py --provider azure --connect
On a supported POSIX host, run:
sh scanner/setup-cloud.sh azure --connect
This first checks that your configuration contains valid resources for the selected
provider, before downloading dependencies. It then prepares or verifies the locked
environment, reads the selected cloud resources to check access, and only then
prompts privately for the agent enrollment token. If the configuration is rejected,
return to Getting started, select the matching cloud collector and download a fresh
agent.local.json into this folder. Repeat the same command after replacing it.
If cloud access fails, follow the diagnostic and run the same command again. No agent
connects and no findings are uploaded by the access check. Keep the terminal open;
Ctrl+C stops the foreground agent. Use the same command to reconnect.
Omit --connect to prepare dependencies only. The separate access-check and connect
commands below remain available for troubleshooting. Azure and GCP Python setup
includes separate macOS 11+ wheel locks for Apple Silicon and Intel with CPython 3.12. Mac wheel hashes, tags and dependency requirements are verified; native Mac execution and live cloud-account acceptance remain pending.
Before you install
For a workstation, install Azure CLI
on the same computer as the collector. Reopen Terminal or PowerShell after installation.
The current Azure CLI requires macOS 13 or newer, even though the Python
collector's wheel set supports macOS 11+. With Homebrew already installed, run
brew update && brew install azure-cli. On Windows with WinGet, run
winget install --exact --id Microsoft.AzureCLI; Windows Server without WinGet
can use Microsoft's installer. Check az version in a new terminal.
See Microsoft's Mac prerequisites.
Run az login locally under the account that runs the collector. Signing in to
Azure Cloud Shell does not sign in your Mac or Windows workstation. Azure CLI's
bundled runtime does not provide the agent's Python 3.12 environment.
In Getting started choose Azure CLI — this workstation. The generated sign-in
command asks for the Directory (tenant) ID from Microsoft Entra ID > Overview,
opens browser sign-in, and prints the selected directory so you can check it.
The guided command now verifies that the active directory matches your input and
stops on a mismatch. With multiple subscriptions, select one in the vault's directory
during sign-in. Signing in alone does not prove permission to read the selected key;
the collector's Check cloud access step performs that check.
This path uses your signed-in identity; do not create the federated app described in
the hosted-connection guide. The CLI must remain available to the account running
the collector. A background service does not inherit your workstation login.
If signing in manually, replace DIRECTORY_ID with that Azure directory ID:
az login --tenant DIRECTORY_ID --allow-no-subscriptions
az account show --query tenantId -o tsv
The directory must contain the vault. --allow-no-subscriptions supports identities
with key data access but no subscription listing access; it does not grant key access.
If the browser cannot open, use az login --tenant DIRECTORY_ID --allow-no-subscriptions --use-device-code
and follow Azure's instructions on your own trusted browser.
- Copy a complete Key Identifier from Azure portal > Key vaults > your vault > Keys > your key > a specific version. It must end in the version, not just the key name.
- Choose the identity: Azure CLI for a workstation signed in with
az login, managed identity for an Azure host with that identity enabled, or an explicitly configured service principal/workload identity. A laptop cannot use managed identity merely by selecting it in the wizard. - Ask the vault administrator to grant that identity key read access. For an RBAC vault,
use a reviewed role containing
Microsoft.KeyVault/vaults/keys/readat the selected key scope. For an access-policy vault, use key Get. Do not change a shared vault's authorization model. The grant covers the key's versions; local configuration limits which versions this collector reads. - Confirm the host can reach the vault. Private vaults require the appropriate network and DNS access. Do not broaden the firewall to work around an authentication error.
In Getting started, select Azure Key Vault, the host operating system and Binary for setup without Python. Download the scoped configuration, follow the installation steps, then run Check cloud access before connecting the agent.
macOS 11+ Python setup is available for Apple Silicon and Intel using CPython 3.12. Native Mac execution and live Azure account acceptance remain outstanding; SDK transport fixtures validate the collector but do not prove access to your vault.
macOS Python setup
Install maintained CPython 3.12 through your managed software catalog or, if
you already use Homebrew, run brew install python@3.12. The launcher finds it
without changing PATH. For an existing python.org installation, run
Install Certificates.command in Applications > Python. Use macOS 11
or newer. Setup selects the wheel lock for the architecture of the running Python
interpreter (Apple Silicon or Intel), verifies all package hashes, and prepares an
isolated azure-agent-env directory. It never installs global packages or requires sudo.
Save agent.local.json beside Start Agent.command in the current verified
bundle. Double-click Start Agent.command. It detects Azure from your configuration
and prepares the Azure environment automatically. Alternatively, type sh in
Terminal, drag start-agent.sh into the window and press Return. You do not need
to navigate folders or select a Python executable. Use the same launcher to reconnect.
For a workstation, select Azure CLI explicitly in Getting started and sign in
to the directory containing your vault with az login --tenant <directory-id>. A managed identity is not created by selecting
it in the wizard. A passing local check does not prove provider access; the combined
command checks access before asking for your enrollment token.
Mac wheel downloads and dependency closure have passed verification. Execution on actual Mac hardware is still pending. The native CI workflow includes this setup path; these instructions do not imply a compiled macOS binary or launchd service.
Compiled collector
Choose Binary in Getting started to use the Windows or Linux collector without installing Python or provider SDKs. Follow cloud binary setup for the local identity, access check and service-account requirements. The Python workflow below remains available.
Guided installation and access check
For a connected host, use Getting started to select this collector, save its scoped configuration, and prepare the verified bundle. The wizard offers the combined command above, with separate checks available under troubleshooting. On Windows, run:
py -3.12 scanner/setup_cloud.py --provider azure
On a supported POSIX host, run:
sh scanner/setup-cloud.sh azure
You can repeat this setup command. If the existing environment matches this bundle, setup checks its Python, SDK imports, locked package versions and dependency health, then reuses it without downloading or reinstalling packages. An incomplete or mismatched environment is preserved: extract the current signed bundle into a fresh folder and run setup there. This local check does not verify Azure permissions; run Check cloud access next.
Use the wizard's Copy access check command with the prepared environment. It reads
only the configured resources with your local identity, requires no platform enrollment
token, and uploads nothing. A successful result has "ready": true and exit code 0.
Failures provide fixed recovery guidance and a zero-based resourceIndex referring
to the configured resource order. Resolve failures before using Copy connect command.
Access can change after the check; inspect the first scan result as well.
The lower-level commands below remain available for offline dependency preparation.
Select the access scope
Use complete key-version URLs from Azure public cloud, for example:
python scanner/azure_keyvault.py permissions --key-version https://quantum-test.vault.azure.net/keys/signing/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
This offline command needs no Azure SDK or credentials. It produces review guidance for the Microsoft.KeyVault/vaults/keys/read data action, or get for a legacy access policy. It does not grant permissions or generate a complete deployable role assignment. The returned URLs are data-plane key identifiers; an administrator must resolve the corresponding ARM key resource scope when assigning a reviewed custom role. Prefer a key-scoped RBAC grant to vault-wide access. A key grant covers its versions; the collector's version selection is a separate local boundary.
Azure's key-read permission provides public key material and permits some public-key operations. Do not describe it as a metadata-only IAM permission. The collector only calls Get Key, never encryption, signing, verification, key mutation, secret retrieval, or enumeration. It retains neither public nor private key material in its report.
The collector accepts 1–200 unique URLs with explicit 32-character hexadecimal versions. It rejects versionless paths, aliases, query parameters, fragments, user information, custom ports, wildcard scopes, and alternate hosts before initializing credentials. Managed HSM endpoints and sovereign clouds are not supported yet. Private endpoints can use the normal public-cloud vault hostname with the host's approved private DNS configuration.
Choose a local identity
Prepare the fourteen pinned dependencies on a connected machine, using the target that matches the agent host:
| Dependency target | Agent environment | Validation so far |
|---|---|---|
azure-windows-x86_64-cpython312 | Windows x86_64, CPython 3.12 | Offline installation and real SDK transport fixtures passed |
azure-windows-x86_64-cpython314 | Windows x86_64, CPython 3.14 | Downloaded wheel hashes verified; environment execution pending |
azure-linux-x86_64-cpython312 | Linux x86_64, CPython 3.12, glibc 2.34+ | Restricted Linux installation, imports, CLI startup and repeat preservation passed |
python scanner/download_dependencies.py --target azure-windows-x86_64-cpython312 --directory azure-wheels
python scanner/create_cloud_environment.py --provider azure --directory azure-agent-env --wheelhouse azure-wheels
The first command downloads only the hash-approved wheel set. Copy the completed wheel directory and verified bundle setup tools to an offline host if needed. The second command selects the host's lock, verifies every wheel, installs offline into a new directory, checks imports and versions, then writes a completion receipt. It preserves existing or interrupted environments; after resolving a failure, choose a new destination. Neither command changes global Python or installs a native service.
Use azure-agent-env/Scripts/python.exe on Windows or azure-agent-env/bin/python on Linux for the collector. Native dependencies require platform-specific locks. macOS 11+ has separate Apple Silicon and Intel locks for CPython 3.12. Linux/Windows ARM64 and Python 3.13 remain unsupported by this setup tool.
For a workstation, install Azure CLI and run az login --tenant <directory-id>
as the same OS user who will start the collector. Select Azure CLI in the wizard.
Managed identity works only on an Azure host with that identity enabled; selecting it
on a regular laptop does not create an identity. The signed-in user still needs the
key data permission described above. Use the hosted Azure connection
when you want scans without a collector.
Choose one identity method explicitly. There is no fallback to another account if authentication fails:
| Method | Intended setup |
|---|---|
managed-identity | An Azure-hosted agent with a system-assigned identity, or a user-assigned identity selected locally through AZURE_CLIENT_ID |
workload-identity | Locally configured tenant, client ID and federated token file for Azure workload identity |
environment | A locally provisioned service-principal environment supported by Azure Identity |
azure-cli | Foreground development using the operator's existing Azure CLI sign-in |
For example, on Windows after preparing the environment and reviewing its Azure identity:
azure-agent-env/Scripts/python.exe scanner/azure_keyvault.py scan --identity azure-cli --key-version https://quantum-test.vault.azure.net/keys/signing/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
The collector does not launch a browser, prompt for credentials, or sign the user in. Identity configuration remains local. Environment and workload identity use the public-cloud authority; the token scope is fixed to Key Vault. Azure CLI execution has a ten-second process timeout. Identity acquisition otherwise follows the selected SDK method and is separate from the provider-request time budget.
Provider requests use verified HTTPS, API version 2025-07-01, no redirects, and no proxy or CA overrides inherited from the environment. Authentication challenges cannot change the target authority or token audience. Requests have connect/read timeouts of 3/10 seconds, a 128 KiB response limit, and cancellation checkpoints. A twenty-second elapsed budget is checked between response chunks; it is not a hard process deadline. These provider settings do not override the identity SDK's own transport configuration.
Read results and resolve failures
Reports retain the selected key identity, known key type, software/HSM protection, enabled state when present, and recognized EC curve. Tags, key parameters, release policy, attestations, credentials and raw provider errors are excluded. Authentication and key-establishment posture remain unknown because key capability does not prove runtime use. Symmetric key types remain unknown rather than implying a cipher or strength.
Managed agent development
Use scanner 0.18.0 or newer for managed Azure jobs. Enroll the azure-keyvault capability and configure a local ceiling of approved versions:
In the workspace console, select Azure Key Vault metadata when enrolling, then open Getting started. Choose the agent operating system, paste the complete key-version URL and select the identity method already configured on the host. Download the local configuration, prepare the locked environment and run the displayed doctor command. Changing the key or identity method requires preparing the configuration again before creating a scan. The wizard does not sign in to Azure, grant permissions or transmit identity credentials. Mac setup uses the same single command with a platform-specific environment.
{
"source": "azure-keyvault-agent",
"allowedAzureKeyVersions": [
"https://quantum-test.vault.azure.net/keys/signing/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
],
"azureIdentity": "managed-identity",
"managedConfiguration": true,
"pollSeconds": 15
}
Run scanner/qr.py doctor --config agent.local.json with the Azure environment's Python executable before starting the agent. Doctor validates scope and imports the SDK without initializing an identity or requesting a token. Configure the scoped platform credential separately through the protected environment or token file described in the agent guide.
Publish managed settings containing allowedAzureKeyVersions as a subset of the local list, alongside the required enabled, polling and other scope fields. The agent acknowledges the revision before claiming jobs. Omitting the Azure list disables Azure discovery for that revision. The control plane cannot select azureIdentity, supply credentials, or replace provider endpoints; these settings are rejected. Jobs and schedules each target one complete version URL.
The agent checks its approved local scope before initializing Azure credentials. Incomplete discovery fails the job without uploading observations. Cancellation and lease loss stop processing at checkpoints and prevent subsequent uploads or completion. Provider requests already in flight remain subject to their network timeouts. Cloud scope publication does not grant Azure IAM access.
Local command diagnostics
Exit code 0 means all selected versions returned matching metadata. Exit code 2 means setup failure or incomplete analysis. Reports are local JSON; this command does not upload evidence.
| Diagnostic | Next check |
|---|---|
azure.keyvault.unauthenticated | Confirm the selected identity belongs to the intended tenant and can obtain a public-cloud Key Vault token. |
azure.keyvault.access-denied | Review key-scoped read access and the vault's firewall/private endpoint rules. |
azure.keyvault.not-found | Copy the full key URL and its version again. |
azure.keyvault.invalid-metadata | The response did not match the requested key or expected structure; do not treat the scan as complete. |
azure.keyvault.request-failed | Check the selected local identity configuration, DNS, TLS trust and connectivity. Raw SDK errors are intentionally omitted. |
Validation status
Collector tests cover scope restrictions, conservative evidence, response identity, malformed and oversized JSON, cancellation, resource cleanup and fixed diagnostics. Additional tests use the hash-locked Azure Identity 1.26.0 and Requests 2.34.2 environment on Windows CPython 3.12 with synthetic Azure CLI output and intercepted HTTP. They verify real token parsing, request headers, TLS/proxy settings, redirect refusal, authentication-challenge handling and error redaction. Processes and network connections are blocked in those tests; they do not establish live Azure connectivity or production readiness. Dependency setup tests also verify platform selection, separate provider inventories, offline installation commands and preservation of incomplete environments.
Verify access before starting the agent
Scanner 0.21.0 adds an explicit read-only access check. After local doctor checks pass, run this with the dedicated cloud environment's Python interpreter (Windows example):
azure-agent-env/Scripts/python.exe scanner/qr.py cloud-check --config agent.local.json --kind azure-keyvault
On Linux use the environment's bin/python. The command contacts the provider using the identity configured on this host and reads only the exact locally allowlisted resources for the selected source. It never contacts the platform or uploads observations. No platform credential is required. It uses the same metadata validation as discovery, so invalid or mismatched responses fail the check.
Exit 0 means every configured resource was read and validated; exit 2 means configuration, identity, provider access or metadata validation failed. resourceIndex is zero-based and refers to the selected provider's array in your local configuration. Output includes fixed diagnostic codes and suggested remedies, excluding resource identifiers, key metadata and raw SDK errors. Partial success remains a failure overall. Correct the failed resource or identity setup before starting the agent; do not widen permissions to fix a dependency or connectivity failure.
This is a point-in-time access check. It does not verify platform enrollment, continuous service operation, future permissions or an end-to-end scan. The local doctor remains offline. Open Getting started > Review local diagnostics, select this provider and your agent distribution, and copy the command to save cloud-access.json. Choose that file in the dialog for per-resource results and corrective guidance. The file is read only in your browser; it is not uploaded or saved.