Skip to content

Bug(azure): Mismatch between auto generated namespaces and actual namespaces #5760

@erezrokah

Description

@erezrokah

Describe the Bug

Most resources in Azure use the SubscriptionMultiplexRegisteredNamespace which creates a client per namespace.
The namespaces are auto generated based on the Go packages and are written to:

const NamespaceMicrosoft_AAD = "Microsoft.AAD"

Looks like there are a bunch of non existent namespaces being generated. The supported list can be retrieved via az provider list | jq -r '.[].namespace' or by looking at https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers (az provider list returns a longer list which is a bit confusing so I'm not sure which one to use).

As a result these resources are always filtered out since they don't get returned there:

for _, p := range providerPage.Value {

Expected Behavior

Don't generate or use the SubscriptionMultiplexRegisteredNamespace for namespaces that don't exist

Steps to Reproduce

Run a sync with the Azure v2 plugin on any account and see that the tables from offending namespaces are never synced (you don't see them in the logs).

This is a different issue from #5758 where the namespace is valid but not registered on the subscription. The namespaces mentioned in this issue are not even returned by the armresources.NewProvidersClient API call(s).

Possible solution

I'm not sure we even need the SubscriptionMultiplexRegisteredNamespace as other than the existence check in

if _, ok := client.registeredNamespaces[subId][namespace]; ok {
we don't use it anywhere.
Maybe we can just not use that multiplexer, remove the namespaces resolving altogether and assume that if the Go API exists we can use it?

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