Skip to content

Bug: Incorrect Reference and Type Error in Azure Managers #98

Open
@long-pham-ts

Description

@long-pham-ts

Hi team,
While working with the plugin to collect resources from Azure, I encountered two issues that I’d like to report:

  1. Incorrect Public IP Prefix Count in NATGatewaysManager:

"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"])

  1. Type Error in VMScaleSetsManager Due to autoscale_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! 🙌

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