Skip to content

azure_rm_virtualmachine: enable custom storage account #392

Open
@Sneedes

Description

@Sneedes

Attempting to utilize azure_rm_virtualmachine module to define an Azure Virtual Machine with:

  • Boot Diagnostics Enabled
  • Custom Storage Account in a different Resource Group than the VM
  • VM using managed disks

Appears the Ansible module is written in such a way that the VM Boot Diagnostics cannot be enabled with an existing Storage Account that exists outside of the Resource Group of the VM. Noting that this can occur in the Azure Portal/GUI.

Azure Portal> Target VM > Support + troubleshooting > Boot diagnostics >Settings
Status: Enable with custom storage account
Diagnostics storage account drop-down lists possible Storage Accounts that may be utilized

Encounter the following error message from Ansible:

Error fetching storage account myCustomStorageAccount- Azure Error: ResourceNotFound

Message: The Resource 'Microsoft.Storage/storageAccounts/myCustomStorageAccount' under resource group 'myVMResourceGroup' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

- name: Create Azure VM myVMName
  azure_rm_virtualmachine:
    name: myVMName
    resource_group: myVMResourceGroup
    managed_disk_type: "Premium_LRS"
    boot_diagnostics": {
      enabled: true,
      storage_account: myCustomStorageAccount
$ ansible-config dump --only-changed
INTERPRETER_PYTHON(.ansible.cfg) = auto_silent

$ ansible --version
ansible 2.10.0.dev0
  config file = .ansible.cfg
  configured module search path = [u'.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/azure-20200212/lib/python2.7/site-packages/ansible
  executable location = /opt/ansible/azure-20200212/bin/ansible
  python version = 2.7.5 (default, Aug 13 2020, 02:51:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions