Skip to content

Azure resource tags

Patchy has no Azure scanner source. Azure findings arrive through Wiz (or a future source). The azure Integration provides the context enhancer. It looks up a finding's Azure resource in Azure Resource Graph, copies the resource's tags onto the finding, and finds the owning repository from them. It is the Azure counterpart of the Google Cloud Asset Inventory and AWS resource-tags enhancers. Like every enhancer, it acts on the finding's cloud resource only, whatever source the finding came from.

One inventory, one question

The enhancer asks one question: given this ARM resource ID, what are the resource's tags? Unlike AWS, there is no backend to choose. Azure Resource Graph is free, always on, and spans the tenant. The enhancer runs one KQL query (Resources | where id =~ …) and reads the tags off the row. The query is case-insensitive because ARM resource IDs are. The scope is every subscription the enhancer's identity can read. You do not need to list subscriptions or set anything up across your Azure estate first. resourceTags.managementGroup can narrow the query to one management group.

Resource Graph can lag behind real changes by a few minutes. That does not matter here, because a finding accumulates for an hour before enhancement runs.

The ownership tags

The shared vocabulary, spelled as tags:

scm-repository-org:      acme          # the organization
scm-repository-name:     infra-prod    # the repository
scm-repository-provider: github        # optional; defaults to github

Or, where a single value is easier to manage:

scm-repository-url:      https://github.com/acme/infra-prod

An Azure tag value can carry :// as written, like an AWS tag and unlike a Google Cloud label. The scheme is still optional, so one vocabulary can be shared across clouds. If you already have a naming convention, you can change the key names (resourceTags.tags, below).

The resource's tags also become finding attributes (tag:<key>, up to 24), alongside azure-subscription, resource-type and location. The tracking issue and the investigating agent can see them, whether or not a repository resolved.

Enabling it

apiVersion: patchy.bitwisemedia.uk/v1alpha1
kind: Integration
metadata:
  name: azure
  namespace: patchy
spec:
  provider: azure
  azure:
    resourceTags:
      enabled: true
      # Optional: narrow the scope to one management group
      # (default: every subscription the identity can read).
      # managementGroup: platform-mg
      # Optional: the forge host composed into a resolved URL (default github.com).
      # repositoryHost: github.example.com
      # Optional: override the tag names read off a resource.
      # tags:
      #   org: scm-repository-org
      #   name: scm-repository-name
      #   provider: scm-repository-provider
      #   url: scm-repository-url

The context-controller reads the block on each enhancement, so changes apply without a restart. An azure Integration has no secretRef. Like the google-cloud and aws Integrations, it holds no key material anywhere. Credentials come from the Azure default chain and need read access only. The built-in Reader role on the management group or subscriptions is enough.

  • On AKS, use Microsoft Entra Workload ID. Annotate the service account with the client id of a federated managed identity. Label the pod so the webhook injects the token:
contextController:
  serviceAccount:
    annotations:
      azure.workload.identity/client-id: 00000000-0000-0000-0000-000000000000
  podLabels:
    azure.workload.identity/use: "true"
  • Anywhere else (including GKE), use workload identity federation. Create a federated credential on a Microsoft Entra app or managed identity that trusts the cluster's service-account token issuer. Then set AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE (a projected service-account token) on the context-controller deployment. The SDK picks them up with no patchy configuration.

When no repository resolves

The shared rules apply. Some resources have no ownership tags. Resource Graph may have no record of others, because they were deleted or are not indexed yet. Both count as a clear answer. A lookup that failed (throttling, an identity binding still propagating) is held and retried instead.

One special case also applies to AWS. A Wiz Defend threat that names no specific resource falls back to a synthetic resource at subscription level. No inventory records these, so the enhancer skips them instead of looking them up.