Registry / devops / c7n-azure

c7n-azure

JSON →
library0.7.50pypypiunverified

Extension for Cloud Custodian that provides Azure resource management capabilities (policy-as-code for Azure). Current version: 0.7.50. Released irregularly alongside c7n core.

pip install c7n-azure
INSTALL
IMPORT
SIG · C7N-AZURE
C
c7n-azure
devopspythonv0.7.50
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

AzureSubscriptionFilter
from c7n_azure.provisioning.autoscale import AutoScale
from c7n_azure.resources.autoscale import AutoScale
AutoScale moved to provisioning module in recent versions
AzureResourceManager
from c7n_azure.resources.arm import ArmResourceManager
from c7n.resources.azure import ArmResourceManager
Azure-specific resources are under c7n_azure.resources
AzureResourceProvider
from c7n_azure.provider import Azure
from c7n.providers.azure import Azure
Azure provider class is in c7n_azure, not c7n core

Initialize Azure provider and run a simple policy listing VMs with a specific tag.

from c7n_azure.provider import Azure from c7n.config import Config from c7n.policy import Policy config = Config.empty( config={ 'accounts': [{'subscription_id': '<subscription_id>'}], 'options': {'cache-period': 0, 'metrics': None} } ) provider = Azure() policies = provider.initialize_policies( [{ 'name': 'test-policy', 'resource': 'azure.vm', 'filters': [{'tag:Environment': 'production'}]} ], config ) for p in policies: print(p.name)
Debug
Known issues
deprecatedazure.common and old Azure SDK authentication (ServicePrincipalCredentials) are deprecated. Use azure-identity DefaultAzureCredential.
fix
Set environment variables AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET or use managed identity.
affects: >=0.6.0,<0.7.0
breakingAzureSubscriptionFilter moved from c7n_azure.resources to c7n_azure.provisioning.
fix
Change import to 'from c7n_azure.provisioning.autoscale import AutoScale' (if using autoscale) or check moved symbols.
affects: 0.7.x
gotchaRequires Python 3.9.2+ (<4.0). Older Python versions will not install.
fix
Upgrade Python to >=3.9.2.
affects: >=0.7.50
gotchac7n-azure must be installed alongside c7n. Installing only c7n-azure without c7n will fail at runtime.
fix
Install both: pip install c7n c7n-azure
affects: all
Upgrade
Version history
0.7.50latest on PyPI · released May 28, 2026
Audit
Dependencies
c7nrequiredCore Cloud Custodian library required
azure-mgmt-resourcerequiredAzure SDK resource management
azure-identityrequiredAzure authentication (DefaultAzureCredential)
Agent activity
25 hits · last 30 days
node
24
Resources

No resource links recorded.

c7n-azure — pip install c7n-azure · libregistry