Create a Storage Account On Azure With Ansible

In this post, I will share with you how to create a storage account on Microsoft Azure cloud using Ansible.

This post follows the previous article on creating a dynamic inventory for Microsoft Azure with Ansible, which is not needed to complete this post.

Once your Ansible machine is configured to use Azure, you can create, manage and delete almost any service on Azure.

Storage Account

In the playbook below, I will create a storage account inside a resource group. In the configuration, I am using localhost as the host with the azure_rm module and note that I am also specifying the resource group I would like to use.

- name: Create a storage account on Microsoft Azure
  hosts: localhost
  connection: local
  gather_facts: yes
    - name: Create storage account
        resource_group: ubuntu-resources
        name: testaccountnt001
        account_type: Standard_LRS

To run the playbook, I will use the following command.

ansible-playbook playbooks/azure/storage-account.yml

Success! You're on the list.