# Create and attach additional Azure Nic

**URL:** <https://forum.ansible.com/t/create-and-attach-additional-azure-nic/36017>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [November 19, 2021, 10:32pm UTC](https://forum.ansible.com/t/create-and-attach-additional-azure-nic/36017 "2021-11-19T22:32:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nitrous](https://avatars.discourse-cdn.com/v4/letter/n/dfb087/32.png) [@Nitrous](https://forum.ansible.com/u/Nitrous)\
**Post date:** [November 19, 2021, 10:32pm UTC](https://forum.ansible.com/t/create-and-attach-additional-azure-nic/36017/1 "2021-11-19T22:32:09Z")

</div>

How can we add additional Azure NICs to a VM , while it is being built.

Sometimes we have a need for more than 1 NIC to be used to a VM, being built.

Current code for

- name: Create a network interface with dns servers  
azure\_rm\_networkinterface:  
name: “{{ hostname }}-nic1”  
state: present  
resource\_group: ‘{{ server.az\_vm\_rg }}’  
virtual\_network:  
name: ‘{{ server.az\_nic\_vnet }}’  
resource\_group: ‘{{ server.az\_vnet\_rg }}’  
subnet\_name: ‘{{ server.az\_nic\_subnet }}’  
public\_ip: false  
dns\_servers:
- ‘{{ server.dnsserver1 }}’
- ‘{{ server.dnsserver2 }}’
- ‘{{ server.dnsserver3 }}’  
ip\_configurations:
- name: lan1  
primary: True  
private\_ip\_allocation\_method: Static  
private\_ip\_address: ‘{{ server.az\_vm\_ipaddress }}’  
application\_security\_groups: ‘{{ server.az\_vm\_asg }}’  
create\_with\_security\_group: false  
#tags: ‘{{ server.az\_vm\_tags }}’  
register: azure\_nic Thanks
