diff --git a/plugins/inventory/azure_rm.py b/plugins/inventory/azure_rm.py index 30f9bdc8d8..e1dd63811d 100644 --- a/plugins/inventory/azure_rm.py +++ b/plugins/inventory/azure_rm.py @@ -608,7 +608,8 @@ def hostvars(self): # set nic-related values from the primary NIC first for nic in sorted(self.nics, key=lambda n: n.is_primary, reverse=True): # and from the primary IP config per NIC first - for ipc in sorted(nic._nic_model['properties']['ipConfigurations'], key=lambda i: i['properties'].get('primary', False), reverse=True): + for ipc in sorted(nic._nic_model.get('properties', {}).get('ipConfigurations', []), + key=lambda i: i.get('properties', {}).get('primary', False), reverse=True): try: subnet = ipc['properties'].get('subnet') if subnet: