Azure IP ASG

How would you make this work, only if ASG is provided:

ip_configurations:

  • name:xxxx
    primary: True
    private_ip_allocation_method: Static
    private_ip_address: ‘{{ server.az_vm_ipaddress }}’
    #application_security_groups: ‘{{ server.az_vm_asg }}’

If in my az_vm_asg is not defined as a variable in my yaml file for the build, it errors out, saying:

“The error was: ‘dict object’ has no attribute ‘az_vm_asg’”

So I have to comment out the asg section in the module for azure_rm_networkinterface, for the build to run. Is it possible to not have that commented out and still have a null variable accepted for az_vm_asg,
in my yaml build file? Thanks

https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#making-variables-optional