# AzureStack - azure\_rm\_virtualmachine - Not accecpting api\_profile

**URL:** <https://forum.ansible.com/t/azurestack-azure-rm-virtualmachine-not-accecpting-api-profile/34043>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [October 15, 2020, 8:34pm UTC](https://forum.ansible.com/t/azurestack-azure-rm-virtualmachine-not-accecpting-api-profile/34043 "2020-10-15T20:34:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charles\_Shaw](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Charles\_Shaw](https://forum.ansible.com/u/Charles_Shaw)\
**Post date:** [October 15, 2020, 8:34pm UTC](https://forum.ansible.com/t/azurestack-azure-rm-virtualmachine-not-accecpting-api-profile/34043/1 "2020-10-15T20:34:19Z")

</div>

Hi there,

I am working with ansible 2.9 and ansible[azure] modules. These have been successfully installed and configured, as I can create resources within AzureStack.

ansible 2.9.0  
config file = /ansible/azure\_stack/ansible.cfg  
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible  
executable location = /usr/local/bin/ansible  
python version = 3.6.8 (default, Apr 2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

However, my playbook fails when it comes to creating a virtual machine. The playbook is able to create vnet, subnet, nsg, public ip, nic all without issue and without specifying api\_profile parameter. I am only encountering this with the virtualmachine resource.

I’ve reviewed the documentation and searched around for examples but I can’t find anything pertaining to AzureStack and Ansible.

Task:

- name: Create VM  
azure\_rm\_virtualmachine:  
resource\_group: ansible  
name: “vm-linuxweb-{{ count }}”  
vm\_size: Standard\_DS1\_v2  
admin\_username: ansible  
admin\_password: “{{ ansible\_password }}”  
ssh\_password\_enabled: true  
network\_interfaces: nic-linux  
image:  
offer: centos  
publisher: openlogic  
sku: ‘7.5’  
version: latest  
api\_profile: “2017-03-09-profile”

I’ve been trying various versions for the api\_profile parameter and nothing is working, but it draws out different errors.

Errors:

- api\_profile: “latest”  
The error was: Message: The resource type ‘locations/vmSizes’ could not be found in the namespace ‘Microsoft.Compute’ for api version ‘2018-06-01’. The supported api-versions are ‘2015-06-15,2016-03-30,2017-03-30,2017-12-01’

- api\_profile: “2017-03-09”  
Error retrieving resource group ansible - ‘unknown Azure API profile: 2017-03-09’"

- api\_profile: “2017-03-09-profile”  
The error was: Message: The resource type ‘locations/vmSizes’ could not be found in the namespace ‘Microsoft.Compute’ for api version ‘2018-06-01’. The supported api-versions are ‘2015-06-15,2016-03-30,2017-03-30,2017-12-01’

I know getting anything to work on AzureStack can be a challenge, but I really hoping I can get this going as Ansible has really helped in other areas.

Thank you,  
Charles
