Skip to main content

Microsoft Azure Cloud Provider for Idem

CodeFactor Python Slack

Azure is a cloud service offered by Microsoft that provides virtual machines, SQL services, media services, and more. Azure Resource Manager is the next generation of the Azure portal and API. This provider is a POP plugin and an extension of Idem, allowing Idem users to leverage Microsoft Azure Resource Manager functionality to enforce the state of cloud infrastructure, applications, configurations, and more.

INSTALLATION

The azurerm idem provider can be installed via pip:

pip install idem-azurerm

INSTALLATION FOR DEVELOPMENT

  1. Clone the idem-azurerm repository.
  2. Install requirements with pip:
pip install -r requirements.txt
  1. Install idem-azurerm in "editable" mode:
pip install -e <path cloned repo>

You are now fully set up to begin developing additional functionality for this provider.

CREDENTIALS

This provider requires that a dictionary populated with valid Azure credentials be passed via acct.

The credentials can be stored in an arbitrarily named file, such as myawesomecreds.yml

#!yaml

azurerm:
  default:
    client_id: "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
    secret: "X2KRwdcdsQn9mwjdt0EbxsQR3w5TuBOR"
    subscription_id: "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
    tenant: "cccccccc-cccc-cccc-cccc-cccccccccccc"

In order to prepare the credentials file for use, the acct command can be run to encrypt the file with the Fernet algorithm.

(env) $ acct myawesomecreds.yml
New encrypted file at: myawesomecreds.yml.fernet
The file was encrypted with this key:
71Gbz2oDSv40Er9YUFBJPzOjtCi6Z2-5niBHPekkvqs=

Now we have an encrypted file containing the credentials and a symmetric key for decryption. Since you have encrypted the file with the key, you can now remove the original plaintext file.

(env) $ rm myawesomecreds.yml

All we have to do now is to tell idem where to get the file and key for acct. This information can be passed to acct on the command line as parameters, but we will set up environment variables for the purposes of this tutorial.

(env) $ export ACCT_FILE="/path/to/myawesomecreds.yml.fernet"
(env) $ export ACCT_KEY="1Gbz2oDSv40Er9YUFBJPzOjtCi6Z2-5niBHPekkvqs="

RESOURCE DEFINITION

After installation, the Azure Resource Manager Idem Provider execution and state modules will be accessible to the hub.

The following example uses an azurerm state module to ensure the existence of a resource group.

Let's call this file "mytest.sls"

Resource group exists:
  azurerm.resource.group.present:
    - name: idem
    - location: eastus
    - tags:
        organization: EITR Technologies

TESTING AND BUILDING RESOURCES

Before you build the resources defined in the ".sls" file you may want to test what will happen when the state file is run. To do this, run idem with the --test option.

(env) $ idem state mytest.sls --test

Once you determine that your state file with perform the intended operations, then you can build the defined resources by running idem like so:

(env) $ idem state mytest.sls

Release files for idem-azurerm 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for idem-azurerm 4.0.0
File Size Uploaded
idem-azurerm-4.0.0.tar.gz 169.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for idem-azurerm 4.0.0
File Interpreter ABI Platform
idem_azurerm-4.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 521.6 kB

Release files / idem-azurerm-4.0.0.tar.gz

Download URL idem-azurerm-4.0.0.tar.gz
Size 169.5 kB
Tags Source
SHA-256 checksum
How to use checksums
24252973681f26e9d9d11b4f70efed140330aa38942d7c23f1afc1e8335045e0
BLAKE2b-256 checksum
How to use checksums
1a47eb4f3175a3931e527c92caafc64768e9353920f3cfa20e9bfafd7d3d61ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

Release files / idem_azurerm-4.0.0-py3-none-any.whl

Download URL idem_azurerm-4.0.0-py3-none-any.whl
Size 352.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1673e401c336d455a52d4f43649ee97deef8a841b4b62fd0341351cec4cf0435
BLAKE2b-256 checksum
How to use checksums
17b7da2d8b8b9481bed222438198fdf6c900905e70142b407533c637995643ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files

3.0.0

2 release files

2.4.0

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page