Test Kitchen and Chef Provisioning drivers for Azure now work in US Government and Sovereign cloud environments

This post first appeared on Medium.

As an open-source maintainer one of the hardest things is getting access to relevant test environments to test your bits. Especially when that test environment is in a territory or environment you don’t have access to.

I’ve been lucky enough this week to get access to a subscription for the Azure US Government cloud environment, and this has meant I have been able to make fixes to both the kitchen-azurerm and chef-provisioning-azurerm projects.

Test Kitchen (kitchen-azurerm)

Starting with v0.9.0 this driver has support for Azure Government and Sovereign Clouds via the use of the azure_environmentsetting. Valid Azure environments are Azure, AzureUSGovernment, AzureChina and AzureGermanCloud

Example .kitchen.yml for Azure US Government cloud:

---
driver:
  name: azurerm

driver_config:
  subscription_id: 'abcdabcd-YOUR-GUID-HERE-abcdabcdabcd'
  azure_environment: 'AzureUSGovernment'
  location: 'US Gov Iowa'
  machine_size: 'Standard_D2_v2_Promo'

provisioner:
  name: chef_zero

verifier:
  name: inspec

platforms:
- name: ubuntu1604
  driver_config:
    image_urn: Canonical:UbuntuServer:16.04-LTS:latest
  transport:
    ssh_key: ~/.ssh/id_kitchen-azurerm

suites:
  - name: default
    run_list:
      - recipe[vmtesting::default]

Chef Provisioning (chef-provisioning-azurerm)

These changes are available in v0.5.0. The driver will automatically use the correct token provider and management endpoints for the relevant cloud environment. The default driver format for the Azure public cloud is:

with_driver 'AzureRM:abcd1234-YOUR-GUID-HERE-abcdef123456'

This can be changed to one of the following formats:

with_driver 'AzureUSGovernment:abcd1234-YOUR-GUID-HERE-abcdef123456'

with_driver 'AzureChina:abcd1234-YOUR-GUID-HERE-abcdef123456'

with_driver 'AzureGermanCloud:abcd1234-YOUR-GUID-HERE-abcdef123456'

Links/Further Reading:

For further details, to raise issues or contribute, please visit the repositories below:

Happy Provisioning!

Author Stuart Preston

Product Manager at @Chef, Microsoft Azure MVP, Author (see http://bit.ly/chefazure) — based in London, United Kingdom.