{"id":1380,"library":"azure-mgmt-redis","title":"Azure Redis Cache Management","description":"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.","status":"active","version":"14.5.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/redis/azure-mgmt-redis","tags":["azure","redis","cloud","management","microsoft"],"install":[{"cmd":"pip install azure-mgmt-redis azure-identity","lang":"bash","label":"Install package and authentication library"}],"dependencies":[{"reason":"Required for authenticating to Azure services using modern credential types like DefaultAzureCredential.","package":"azure-identity","optional":false},{"reason":"Provides shared core functionality, including transport pipelines, exceptions, and data models.","package":"azure-core","optional":false}],"imports":[{"note":"Older versions or incorrect module paths might lead to `ImportError`. Always use the direct package import.","wrong":"from azure.mgmt.redis.rediscachemanagementclient import RedisCacheManagementClient","symbol":"RedisManagementClient","correct":"from azure.mgmt.redis import RedisManagementClient"},{"note":"This is the recommended way to authenticate in modern Azure SDKs, supporting various authentication flows.","symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.redis import RedisManagementClient\n\n# Set your Azure Subscription ID as an environment variable (e.g., AZURE_SUBSCRIPTION_ID)\n# Or replace os.environ.get with your actual subscription ID.\nsubscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', 'YOUR_SUBSCRIPTION_ID')\n\n# Authenticate using DefaultAzureCredential\n# This will try to authenticate using various methods, e.g., environment variables, managed identity, Azure CLI, Visual Studio Code.\ncredential = DefaultAzureCredential()\n\n# Create a RedisManagementClient\nredis_client = RedisManagementClient(credential, subscription_id)\n\nprint(f\"Listing Redis Caches in subscription {subscription_id}:\")\n\n# List all Redis Caches in the subscription\n# Operations like .list_by_subscription() return an iterator for paginated results.\ntry:\n    for cache in redis_client.redis.list_by_subscription():\n        print(f\"  - Name: {cache.name}, Location: {cache.location}, SKU: {cache.sku.name}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"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.","message":"Breaking 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.","severity":"breaking","affected_versions":"<8.0.0"},{"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())`.","message":"List operations (e.g., `list_by_subscription`, `list_by_resource_group`) return iterable objects (an Azure Pager) for paginated results, not standard Python lists.","severity":"gotcha","affected_versions":"All versions >=8.0.0"},{"fix":"Update `try...except` blocks to catch `HttpResponseError` from `azure.core.exceptions` for API-related errors. Example: `from azure.core.exceptions import HttpResponseError`.","message":"Exception handling for Azure SDK clients changed from `msrestazure.azure_exceptions.CloudError` to `azure.core.exceptions.HttpResponseError` when the SDK moved to `azure-core`.","severity":"breaking","affected_versions":"<8.0.0"},{"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)`.","message":"Many 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"`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.","severity":"gotcha","affected_versions":"All versions >=8.0.0"},{"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","message":"DefaultAzureCredential 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.","severity":"gotcha","affected_versions":"All versions >=8.0.0"}],"env_vars":null,"search_vec":"'14.5.0':38 'azur':1,7,16,31,57 'azure-mgmt-redi':6 'break':55 'bug':46 'cach':3,18 'cadenc':44 'chang':56 'client':10 'cloud':59 'continu':42 'creation':21 'current':35 'delet':23 'featur':50 'fix':47 'follow':40 'function':13 'includ':20 'instanc':19 'introduc':54 'librari':11 'major':52 'manag':4,15,60 'mgmt':8 'microsoft':61 'new':49 'part':28 'provid':12 'python':34 'redi':2,9,17,58 'releas':43 'scale':25 'sdk':32 'updat':22 'version':37,53","created_at":"2026-04-09T03:45:26.970383+00:00","updated_at":"2026-04-15T23:04:25.940352+00:00","problems":{"verify_error":"error: Failed to parse: `azure-mgmt-redis azure-identity`\n  Caused by: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `a`\nazure-mgmt-redis azure-identity\n                 ^"},"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"14.5.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://azure.microsoft.com","github":"https://github.com/Azure/azure-sdk-for-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/azure-mgmt-redis/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["azure","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-05","install_tag":"verified"}}