##### SUMMARY
When using azure_rm inventory plug-in, given Azure subscription, the dynamic inventory results in an incomplete list of VMs, compared to the one that can be obtained in portal.azure.com or via Azure CLI. 

The issue is mainly due to a parsing error that occurs in azure_rm.py. The code expects the 'primary' field to exist in the __nic_model['ipConfigurations'][X]['properties']__ dict. In our existing fleet of Azure VMs, some VMs do not have a primary ipConfiguration set. More precisely, that field is set to 'null', not 'True' or 'False'.

Example:
1. Using Azure cli, dump the ipConfiguration of VM vm01 that has the 'primary' field set to 'true':
```bash
az network nic ip-config list --subscription MySubscription -g MyRG --nic-name vm01nic
[
  {
    "applicationGatewayBackendAddressPools": null,
    "applicationSecurityGroups": null,
    "etag": "W/\"***\"",
    "id": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Network/networkInterfaces/vm01nic/ipConfigurations/ipconfig1",
    "loadBalancerBackendAddressPools": null,
    "loadBalancerInboundNatRules": null,
    "name": "ipconfig1",
    "primary": true,
    "privateIpAddress": "***",
    "privateIpAddressVersion": "IPv4",
    "privateIpAllocationMethod": "Static",
    "provisioningState": "Succeeded",
    "publicIpAddress": null,
    "resourceGroup": "***",
    "subnet": {
      "addressPrefix": null,
      "etag": null,
      "id": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Network/virtualNetworks/***/subnets/***",
      "ipConfigurations": null,
      "name": null,
      "networkSecurityGroup": null,
      "provisioningState": null,
      "resourceGroup": "***",
      "resourceNavigationLinks": null,
      "routeTable": null,
      "serviceEndpoints": null
    },
    "type": "Microsoft.Network/networkInterfaces/ipConfigurations"
  }
]
```
2. Using Azure cli, dump the ipConfiguration of VM vm02 that does not have a boolean value for the 'primary' field:
```bash
az network nic ip-config list --subscription MySubscription -g MyRG --nic-name vm02nic
[
  {
    "applicationGatewayBackendAddressPools": null,
    "applicationSecurityGroups": null,
    "etag": "W/\"***\"",
    "id": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Network/networkInterfaces/vm02nic/ipConfigurations/ipconfig1",
    "loadBalancerBackendAddressPools": null,
    "loadBalancerInboundNatRules": null,
    "name": "ipconfig1",
    "primary": null,
    "privateIpAddress": "***",
    "privateIpAddressVersion": "IPv4",
    "privateIpAllocationMethod": "Static",
    "provisioningState": "Succeeded",
    "publicIpAddress": null,
    "resourceGroup": "***",
    "subnet": {
      "addressPrefix": null,
      "etag": null,
      "id": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Network/virtualNetworks/***/subnets/***",
      "ipConfigurations": null,
      "name": null,
      "networkSecurityGroup": null,
      "provisioningState": null,
      "resourceGroup": "***",
      "resourceNavigationLinks": null,
      "routeTable": null,
      "serviceEndpoints": null
    },
    "type": "Microsoft.Network/networkInterfaces/ipConfigurations"
  }
]
```

In the second example, because of the 'null' value, that field is later removed from the __nic_model__ dict., causing a python error while fetching the inventory.

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
lib/ansible/plugins/inventory/azure_rm.py

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible 2.8.5
  config file = /home/***/ansible/ansible_dev.cfg
  configured module search path = [u'/home/***/ansible/library']
  ansible python module location = /home/***/ansible/.venv/lib/python2.7/site-packages/ansible
  executable location = /home/***/ansible/.venv/bin/ansible
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below
DEFAULT_BECOME_METHOD(/home/***/ansible/ansible_dev.cfg) = sudo
DEFAULT_BECOME_USER(/home/***/ansible/ansible_dev.cfg) = root
DEFAULT_GATHER_TIMEOUT(/home/***/ansible/ansible_dev.cfg) = 30
DEFAULT_HOST_LIST(/home/***/ansible/ansible_dev.cfg) = [u'/home/***/ansible/inventory/azure-dev']
DEFAULT_LOG_PATH(/home/***/ansible/ansible_dev.cfg) = /home/***/ansible.log
DEFAULT_MODULE_PATH(/home/***/ansible/ansible_dev.cfg) = [u'/home/***/ansible/library']
DEFAULT_ROLES_PATH(/home/***/ansible/ansible_dev.cfg) = [u'/home/***/ansible/roles']
DEFAULT_VAULT_IDENTITY_LIST(/home/***/ansible/ansible_dev.cfg) = ***
HOST_KEY_CHECKING(/home/***/ansible/ansible_dev.cfg) = False
INVENTORY_ENABLED(/home/***/ansible/ansible_dev.cfg) = [u'yaml', u'azure_rm', u'script']
RETRY_FILES_ENABLED(/home/***/ansible/ansible_dev.cfg) = False
```

##### OS / ENVIRONMENT
Ansible controller on RHEL 7.4

##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->
1. Use a resource group with one VM that is correctly retrieved via the azure_rm plugin.
1. In that resource group, create another VM with at least one NIC but with no primary ipConfiguration (I don't know whether it is still possible to do so but in our existing fleet of VMs, some do not have any NIC with a primary ipConfiguration)
1. Relaunch the dynamic inventory.

##### EXPECTED RESULTS
All resource group VMs are retrieved.

##### ACTUAL RESULTS
No VM shows up

type: bool
          default: False
          version_added: '2.8'
'''
EXAMPLES = '''
# The following host variables are always available:
# public_ipv4_addresses: all public IP addresses, with the primary IP config from the primary NIC first
# public_dns_hostnames: all public DNS hostnames, with the primary IP config from the primary NIC first
# private_ipv4_addresses: all private IP addressses, with the primary IP config from the primary NIC first
# id: the VM's Azure resource ID, eg /subscriptions/00000000-0000-0000-1111-1111aaaabb/resourceGroups/my_rg/providers/Microsoft.Compute/virtualMachines/my_vm
# location: the VM's Azure location, eg 'westus', 'eastus'
# name: the VM's resource name, eg 'myvm'
# os_profile: The VM OS properties, a dictionary, only system is currently available, eg 'os_profile.system not in ['linux']'
# powerstate: the VM's current power state, eg: 'running', 'stopped', 'deallocated'
# provisioning_state: the VM's current provisioning state, eg: 'succeeded'
# tags: dictionary of the VM's defined tag values
# resource_type: the VM's resource type, eg: 'Microsoft.Compute/virtualMachine', 'Microsoft.Compute/virtualMachineScaleSets/virtualMachines'
# vmid: the VM's internal SMBIOS ID, eg: '36bca69d-c365-4584-8c06-a62f4a1dc5d2'
# vmss: if the VM is a member of a scaleset (vmss), a dictionary including the id and name of the parent scaleset
# sample 'myazuresub.azure_rm.yaml'
# required for all azure_rm inventory plugin configs
plugin: azure_rm
# forces this plugin to use a CLI auth session instead of the automatic auth source selection (eg, prevents the
# presence of 'ANSIBLE_AZURE_RM_X' environment variables from overriding CLI auth)
auth_source: cli
# fetches VMs from an explicit list of resource groups instead of default all (- '*')
include_vm_resource_groups:
- myrg1
- myrg2
# fetches VMs from VMSSs in all resource groups (defaults to no VMSS fetch)