# Ability to create Azure automation account via Ansible

**URL:** <https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [October 5, 2018, 2:51am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729 "2018-10-05T02:51:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [October 5, 2018, 2:51am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/1 "2018-10-05T02:51:54Z")

</div>

Hi Guys,

Are we not able to create an Azure automation account with Ansible? Seems a simple request but I am not able to figure it out.

Would appreciate your guidance.

Thank you very much.

Kind regards  
Ameya Agashe

P. S: Kindly ignore if this sounds too simple question, I am new to Ansible world.

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [October 5, 2018, 4:37am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/2 "2018-10-05T04:37:11Z")

</div>

Apparently, there is no module for creation of azure automation account?

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [October 8, 2018, 11:34pm UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/3 "2018-10-08T23:34:05Z")

</div>

Hi is this message gone in spam somewhere??

Ameya

---

<div class="post-metadata">

**Author:** ![Brad2](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Brad2](https://forum.ansible.com/u/Brad2)\
**Post date:** [October 9, 2018, 9:36am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/4 "2018-10-09T09:36:51Z")

</div>

No, I have no idea what azure is. So, can’t offer any help. You have not provided any details. Possibly describe what the process is for creating an azure account without ansible and what problems you are having with using ansible. Give us the steps you have attempted so far.

---

<div class="post-metadata">

**Author:** ![Ameya\_Agashe](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Ameya\_Agashe](https://forum.ansible.com/u/Ameya_Agashe)\
**Post date:** [October 9, 2018, 10:19am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/5 "2018-10-09T10:19:50Z")

</div>

Hi Brad,

Appreciate your prompt response.Azure is a public cloud offering from Microsoft. WIthout Ansible, I would create the account with “Azure PowerShell” with the below command.:

New-AzureRmAutomationAccount `-ResourceGroupName "${resource_grp_name_fred_nxt_old_prod}"`  
-Name “${azure\_automation\_account\_name}” `  
-Location “${automation\_account\_location}”

What I have done so far is, I am being able to provision a base Windows 2016 Server in Azure, I want to now, automate the manual configuration task, first thing is to provision an automation account. The below snippet is of my yaml file which I run in Azure cloud shell and it provisions the environment.

- name: Create Azure VM  
hosts: localhost  
connection: local  
tasks:
- name: Create resource group  
azure\_rm\_resourcegroup:  
name: myResourceGroup  
location: eastus
- name: Create virtual network  
azure\_rm\_virtualnetwork:  
resource\_group: myResourceGroup  
name: myVnet  
address\_prefixes: “[10.0.0.0/16](http://10.0.0.0/16)”
- name: Add subnet  
azure\_rm\_subnet:  
resource\_group: myResourceGroup  
name: mySubnet  
address\_prefix: “[10.0.1.0/24](http://10.0.1.0/24)”  
virtual\_network: myVnet
- name: Create public IP address  
azure\_rm\_publicipaddress:  
resource\_group: myResourceGroup  
allocation\_method: Static  
name: myPublicIP  
register: output\_ip\_address
- name: Dump public IP for VM which will be created  
debug:  
msg: “The public IP is {{ output\_ip\_address.state.ip\_address }}.”
- name: Create Network Security Group that allows RDP  
azure\_rm\_securitygroup:  
resource\_group: myResourceGroup  
name: myNetworkSecurityGroup  
rules:
- name: RDP  
protocol: Tcp  
destination\_port\_range: 3389  
access: Allow  
priority: 1002  
direction: Inbound
- name: Create virtual network inteface card  
azure\_rm\_networkinterface:  
resource\_group: myResourceGroup  
name: myNIC  
virtual\_network: myVnet  
subnet: mySubnet  
public\_ip\_name: myPublicIP  
security\_group: myNetworkSecurityGroup
- name: Create VM  
azure\_rm\_virtualmachine:  
resource\_group: myResourceGroup  
name: myVM  
vm\_size: Standard\_DS1\_v2  
admin\_username: svc\_admin  
admin\_password: Hash#Dollar$135  
os\_type: Windows  
network\_interfaces: myNIC  
image:  
offer: WindowsServer  
publisher: MicrosoftWindowsServer  
sku: ‘2016-Datacenter’  
version: latest

The main game, as I see is using Azure ansible modules, I couldn’t locate the equivalent to create an automation account.

Kindly assist

Thanks  
Ameya Agashe

---

<div class="post-metadata">

**Author:** ![Brad2](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Brad2](https://forum.ansible.com/u/Brad2)\
**Post date:** [October 9, 2018, 11:39am UTC](https://forum.ansible.com/t/ability-to-create-azure-automation-account-via-ansible/28729/6 "2018-10-09T11:39:42Z")

</div>

OK. Haven’t touched Windows Server for a couple of years. 🙂  
I searched the azure modules in ansible and like you, did not see anything directly related. My suggestion: since you already have a poweshell command to create the account, use the win\_command module to run the powershell command where needed. That will probably be your fastest method to get your task accomplished.
