Registry / azure / azure-mgmt-keyvault

azure-mgmt-keyvault

JSON →
library14.0.1pypypi✓ verified 25d ago

Microsoft Azure Keyvault Management Client Library for Python. It provides an interface to manage Azure Key Vault resources, such as creating, deleting, and updating vaults, and configuring access policies. Current version is 14.0.1. Releases follow the Azure SDK for Python's frequent cadence, often coinciding with new API versions or bug fixes.

pip install azure-mgmt-keyvault azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-KEYVAUL
A
azure-mgmt-keyvault
azurepythonv14.0.1
Install
3.8s avg
Import
591ms
Disk
44MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v14.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.618s · 44.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.8s · import 0.564s · 45MB
44MB installed
● package 44MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KeyVaultManagementClient
from azure.mgmt.keyvault import KeyVaultManagementClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
from azure.common.credentials import ServicePrincipalCredentials
Older authentication methods are deprecated; `azure-identity` is the recommended approach for modern Azure SDKs.

This quickstart demonstrates how to authenticate using `DefaultAzureCredential` and list all Key Vaults within a specified Azure subscription using `KeyVaultManagementClient`. It assumes `AZURE_SUBSCRIPTION_ID` is set as an environment variable and appropriate permissions are granted.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.keyvault import KeyVaultManagementClient # --- Authentication --- # The DefaultAzureCredential attempts to authenticate via several methods, # including environment variables, managed identity, Azure CLI, and more. # For local development, set these environment variables or ensure 'az login' is active: # - AZURE_SUBSCRIPTION_ID (required) # - AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID for service principal # - AZURE_USERNAME, AZURE_PASSWORD for developer accounts subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID") if not subscription_id: raise ValueError("AZURE_SUBSCRIPTION_ID environment variable must be set.") credential = DefaultAzureCredential() # --- Client Initialization --- client = KeyVaultManagementClient(credential, subscription_id) # --- Example: List all Key Vaults in the subscription --- print(f"Listing all Key Vaults in subscription: {subscription_id}") try: vaults_iterator = client.vaults.list() found_vaults = False for vault in vaults_iterator: print(f" - Vault Name: {vault.name}, Location: {vault.location}") found_vaults = True if not found_vaults: print(" No Key Vaults found.") except Exception as e: print(f"Error listing vaults: {e}") print("Ensure your credential has the 'Microsoft.KeyVault/vaults/read' permission at the subscription scope.")
Debug
Known issues
breakingVersion 14.0.0 introduced breaking changes, specifically regarding how `api_version` is handled and changes to the default models namespace. `VaultsOperations` methods no longer accept keyword arguments for `api_version`.
fix
Remove explicit `api_version` keyword arguments from client method calls. If using older API versions explicitly, adjust model imports from `azure.mgmt.keyvault.vYYYY_MM_DD.models` to the new default `azure.mgmt.keyvault.models` or ensure you're using the correct namespace.
affects: >=14.0.0
gotchaThis library (`azure-mgmt-keyvault`) is for *managing* Key Vault resources (create, delete, update policies). It is NOT for interacting with secrets, keys, or certificates *inside* a vault. For data plane operations, use `azure-keyvault-secrets`, `azure-keyvault-keys`, or `azure-keyvault-certificates`.
fix
Always distinguish between management plane (managing the vault itself) and data plane (managing content within the vault). Choose the appropriate library based on your task.
affects: All versions
gotchaAuthentication with `DefaultAzureCredential` relies on a chain of authentication methods. Misconfigured environment variables or lack of `az login` can lead to authentication failures.
fix
For local development, ensure `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET` (for service principal) or `AZURE_USERNAME`, `AZURE_PASSWORD` (for interactive login) are set, or ensure you are logged in via `az login` (Azure CLI). Always verify the `AZURE_SUBSCRIPTION_ID` environment variable is correctly set.
affects: All versions
Upgrade
Version history
14.0.1latest on PyPI · released Mar 27, 2026
Audit
Dependencies
azure-identityrequiredProvides Azure Active Directory authentication mechanisms, commonly used with Azure SDK clients.
Agent activity
47 hits · last 30 days
node
40
OpenAI (training)
1
Resources
azure-mgmt-keyvault — pip install azure-mgmt-keyvault · libregistry