Description
Hi team,
While working with the plugin to collect resources from Azure, I encountered two issues that I’d like to report:
- Incorrect Public IP Prefix Count in
NATGatewaysManager
:
- In the file instance_manager.py, the following line:
"public_ip_prefixes_count": len(nat_gateway_dict["public_ip_addresses"])
appears to be referencing public_ip_addresses instead of public_ip_prefixes when calculating the count for public IP prefixes.
It should be updated to:
"public_ip_prefixes_count": len(nat_gateway_dict["public_ip_prefixes"])
- Type Error in
VMScaleSetsManager
Due toautoscale_settings
Field
- The plugin includes the autoscale_settings field in the VM Scale Set resource data, but this field contains a list of <class 'azure.mgmt.monitor.v2022_10_01.models._models_py3.AutoscaleSettingResource'> objects. These complex objects aren’t converted to dictionaries and can’t be serialized as-is, which leads to a type error at runtime.
- The message error:
Failed to parse resource field: Value {additional_properties: {}, id: /subscriptions/xxxxxx/resourceGroups/xxxxx/providers/microsoft.insights/autoscalesettings/xxxxx, type: Microsoft.Insights/autoscaleSettings, location: southeastasia, tags: {application_name: xxx, business_code: xxx, environment: xxx}, system_data: None, profiles: [<azure.mgmt.monitor.v2022_10_01.models._models_py3.AutoscaleProfile object at 0x7f3bf1dce550>], notifications: [], enabled: False, predictive_autoscale_policy: <azure.mgmt.monitor.v2022_10_01.models._models_py3.PredictiveAutoscalePolicy object at 0x7f3bf1dce310>, name_properties_name: xxxxx, target_resource_uri: /subscriptions/xxxxxx/resourceGroups/xxxxxx/providers/Microsoft.Compute/virtualMachineScaleSets/xxxxx, target_resource_location: None} has unexpected type at ResourceInfo.resource.data.autoscale_settings[0].
=> Since this field isn't needed for inventory purposes, removing it from the output should resolve the issue.
Please let me know if you'd like me to create a PR for these.
Thanks teams! 🙌