# Cloud Custodian - Azure Support
This a plugin to Cloud Custodian that adds Azure support.
## Install Cloud Custodian and Azure Plugin
The Azure provider must be installed as a separate package in addition to c7n.
$ git clone https://github.com/cloud-custodian/cloud-custodian.git
$ virtualenv custodian
$ source custodian/bin/activate
(custodian) $ pip install -e cloud-custodian/.
(custodian) $ pip install -e cloud-custodian/tools/c7n_azure/.
## Write your first policy
A policy specifies the following items:
- The type of resource to run the policy against
- Filters to narrow down the set of resources
- Actions to take on the filtered set of resources
For this tutorial we will add a tag to all virtual machines with the name "Hello" and the value "World".
Create a file named ``custodian.yml`` with this content:
policies:
- name: my-first-policy
description: |
Adds a tag to all virtual machines
resource: azure.vm
actions:
- type: tag
tag: Hello
value: World
## Run your policy
First, choose one of the supported authentication mechanisms and either log in to Azure CLI or set
environment variables as documented in [Authentication](https://cloudcustodian.io/docs/azure/authentication.html#azure-authentication).
custodian run --output-dir=. custodian.yml
If successful, you should see output similar to the following on the command line
2016-12-20 08:35:06,133: custodian.policy:INFO Running policy my-first-policy resource: azure.vm
2016-12-20 08:35:07,514: custodian.policy:INFO policy: my-first-policy resource:azure.vm has count:1 time:1.38
2016-12-20 08:35:08,188: custodian.policy:INFO policy: my-first-policy action: tag: 1 execution_time: 0.67
You should also find a new ``my-first-policy`` directory with a log and other
files (subsequent runs will append to the log by default rather than
overwriting it).
## Links
- [Getting Started](https://cloudcustodian.io/docs/azure/gettingstarted.html)
- [Example Scenarios](https://cloudcustodian.io/docs/azure/examples/index.html)
- [Example Policies](https://cloudcustodian.io/docs/azure/policy/index.html)
Raw data
{
"_id": null,
"home_page": "https://cloudcustodian.io",
"name": "c7n-azure",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Cloud Custodian Project",
"author_email": null,
"download_url": null,
"platform": null,
"description": "\n# Cloud Custodian - Azure Support\n\nThis a plugin to Cloud Custodian that adds Azure support.\n\n## Install Cloud Custodian and Azure Plugin\n\nThe Azure provider must be installed as a separate package in addition to c7n. \n\n $ git clone https://github.com/cloud-custodian/cloud-custodian.git\n $ virtualenv custodian\n $ source custodian/bin/activate\n (custodian) $ pip install -e cloud-custodian/.\n (custodian) $ pip install -e cloud-custodian/tools/c7n_azure/.\n\n\n## Write your first policy\n\nA policy specifies the following items:\n\n- The type of resource to run the policy against\n- Filters to narrow down the set of resources\n- Actions to take on the filtered set of resources\n\nFor this tutorial we will add a tag to all virtual machines with the name \"Hello\" and the value \"World\".\n\nCreate a file named ``custodian.yml`` with this content:\n\n policies:\n - name: my-first-policy\n description: |\n Adds a tag to all virtual machines\n resource: azure.vm\n actions:\n - type: tag\n tag: Hello\n value: World\n\n## Run your policy\n\nFirst, choose one of the supported authentication mechanisms and either log in to Azure CLI or set\nenvironment variables as documented in [Authentication](https://cloudcustodian.io/docs/azure/authentication.html#azure-authentication).\n\n custodian run --output-dir=. custodian.yml\n\n\nIf successful, you should see output similar to the following on the command line\n\n 2016-12-20 08:35:06,133: custodian.policy:INFO Running policy my-first-policy resource: azure.vm\n 2016-12-20 08:35:07,514: custodian.policy:INFO policy: my-first-policy resource:azure.vm has count:1 time:1.38\n 2016-12-20 08:35:08,188: custodian.policy:INFO policy: my-first-policy action: tag: 1 execution_time: 0.67\n\n\nYou should also find a new ``my-first-policy`` directory with a log and other\nfiles (subsequent runs will append to the log by default rather than\noverwriting it). \n\n## Links\n- [Getting Started](https://cloudcustodian.io/docs/azure/gettingstarted.html)\n- [Example Scenarios](https://cloudcustodian.io/docs/azure/examples/index.html)\n- [Example Policies](https://cloudcustodian.io/docs/azure/policy/index.html)\n\n\n\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Cloud Custodian - Azure Support",
"version": "0.7.34",
"project_urls": {
"Documentation": "https://cloudcustodian.io/docs/",
"Homepage": "https://cloudcustodian.io",
"Repository": "https://github.com/cloud-custodian/cloud-custodian"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e556e685d23d8dae7cad3a5284bd3c3a3c738b204260d1aaad8017bc1a02b51",
"md5": "2285243afb9d2792c62bbc7ca93a5f9a",
"sha256": "d4f6392da287add9c30b61002cd0a2f6c84c60754f616b907ddc82eb0abf9451"
},
"downloads": -1,
"filename": "c7n_azure-0.7.34-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2285243afb9d2792c62bbc7ca93a5f9a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 184569,
"upload_time": "2024-03-26T21:21:33",
"upload_time_iso_8601": "2024-03-26T21:21:33.360817Z",
"url": "https://files.pythonhosted.org/packages/9e/55/6e685d23d8dae7cad3a5284bd3c3a3c738b204260d1aaad8017bc1a02b51/c7n_azure-0.7.34-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-26 21:21:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloud-custodian",
"github_project": "cloud-custodian",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "c7n-azure"
}