Registry / azure / azure-mgmt-redis

azure-mgmt-redis

JSON →
library14.5.0pypypi✓ verified 25d ago

The azure-mgmt-redis client library provides functionality to manage Azure Redis Cache instances, including creation, update, deletion, and scaling. It is part of the Azure SDK for Python, currently at version 14.5.0, and follows a continuous release cadence for bug fixes and new features, with major versions introducing breaking changes.

pip install azure-mgmt-redis azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-REDIS
A
azure-mgmt-redis
azurepythonv14.5.0
Install
3.9s avg
Import
577ms
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.5.0 · 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.9s · import 0.536s · 45MB
44MB installed
● package 44MB
Code
Verified usage

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

RedisManagementClient
from azure.mgmt.redis import RedisManagementClient
from azure.mgmt.redis.rediscachemanagementclient import RedisCacheManagementClient
Older versions or incorrect module paths might lead to `ImportError`. Always use the direct package import.
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
This is the recommended way to authenticate in modern Azure SDKs, supporting various authentication flows.

This quickstart demonstrates how to authenticate with Azure, create a `RedisManagementClient`, and then list all Azure Redis Cache instances within a given subscription. Ensure you have set `AZURE_SUBSCRIPTION_ID` and other Azure authentication environment variables (e.g., for service principal) or are logged in via Azure CLI/VS Code.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.redis import RedisManagementClient # Set your Azure Subscription ID as an environment variable (e.g., AZURE_SUBSCRIPTION_ID) # Or replace os.environ.get with your actual subscription ID. subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID') # Authenticate using DefaultAzureCredential # This will try to authenticate using various methods, e.g., environment variables, managed identity, Azure CLI, Visual Studio Code. credential = DefaultAzureCredential() # Create a RedisManagementClient redis_client = RedisManagementClient(credential, subscription_id) print(f"Listing Redis Caches in subscription {subscription_id}:") # List all Redis Caches in the subscription # Operations like .list_by_subscription() return an iterator for paginated results. try: for cache in redis_client.redis.list_by_subscription(): print(f" - Name: {cache.name}, Location: {cache.location}, SKU: {cache.sku.name}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingBreaking changes were introduced in `azure-mgmt-redis` version 8.0.0 due to alignment with the new Azure SDK guidelines. This involved significant changes to client constructor signatures and model names.
fix
For versions 8.0.0 and later, clients are instantiated with `credential` (e.g., `DefaultAzureCredential`) and `subscription_id` directly, following the pattern `RedisManagementClient(credential, subscription_id)`. Older versions used different authentication objects and client constructors.
affects: <8.0.0
gotchaList operations (e.g., `list_by_subscription`, `list_by_resource_group`) return iterable objects (an Azure Pager) for paginated results, not standard Python lists.
fix
Iterate directly over the returned object (e.g., `for cache in client.redis.list_by_subscription():`). If a list is absolutely needed, explicitly convert it: `list_of_caches = list(client.redis.list_by_subscription())`.
affects: All versions >=8.0.0
breakingException handling for Azure SDK clients changed from `msrestazure.azure_exceptions.CloudError` to `azure.core.exceptions.HttpResponseError` when the SDK moved to `azure-core`.
fix
Update `try...except` blocks to catch `HttpResponseError` from `azure.core.exceptions` for API-related errors. Example: `from azure.core.exceptions import HttpResponseError`.
affects: <8.0.0
gotchaMany Azure management operations, especially for existing resources, require a specific resource group name. Failing to provide it will result in an error or incorrect operation.
fix
Always ensure the `resource_group_name` parameter is correctly provided when interacting with resources within a specific resource group. Example: `redis_client.redis.get(resource_group_name, redis_cache_name)`.
affects: All versions
gotcha`DefaultAzureCredential` relies on specific environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID`) or an authenticated Azure CLI/PowerShell installation to obtain tokens. If not properly configured, authentication will fail before any API calls are made.
fix
Ensure that your environment has the necessary Azure authentication setup. This typically involves setting environment variables for service principals, logging in via Azure CLI (`az login`), or using Managed Identity in Azure environments. Refer to the Azure Identity documentation (https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot) for detailed setup instructions.
affects: All versions >=8.0.0
gotchaDefaultAzureCredential requires a configured authentication source (e.g., environment variables, Azure CLI login, Managed Identity, Workload Identity, etc.) to retrieve a token. If no valid source is found or configured, it will fail to authenticate.
fix
Ensure your execution environment has valid Azure authentication configured. This could involve logging in via `az login`, setting `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, and `AZURE_CLIENT_SECRET` environment variables, or running in an environment with a configured Managed Identity or Workload Identity. Refer to the Azure Identity troubleshooting guide for `DefaultAzureCredential` for more details: https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot
affects: All versions >=8.0.0
Upgrade
Version history
14.5.0latest on PyPI · released Jan 20, 2025
Audit
Dependencies
azure-identityrequiredRequired for authenticating to Azure services using modern credential types like DefaultAzureCredential.
azure-corerequiredProvides shared core functionality, including transport pipelines, exceptions, and data models.
Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources