Documentation
¶
Overview ¶
Package azureinv reads an Azure resource's tags from Azure Resource Graph.
It exists because the tags patchy needs are not reliably in the payload that brought the finding: a scanner delivery describes the resource (ARM resource ID, type, subscription) but its tags are optional, point-in-time extras, so ownership has to be looked up separately. Unlike AWS there is no backend to choose: Resource Graph is free, always on, and tenant-wide — one KQL lookup by resource ID answers for every subscription the caller's identity can read, optionally narrowed to a management group.
Credentials come from the Azure default chain — in-cluster that means Microsoft Entra Workload ID or workload identity federation, so no key material exists anywhere — and the lookup is the only reason context-controller talks to Azure. It is read-only.
The client is deliberately thin — one method, one struct — so the enhancer that uses it can be tested against a hand-written fake and neither the enhancer nor anything in pkg/ ever names an Azure SDK type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("resource not found in azure inventory")
ErrNotFound reports that the inventory has no record of the resource. This is a permanent answer, not a transient one: the resource may have been deleted between the finding being raised and this lookup, it may live in a subscription outside the configured scope, or it may not be indexed yet. Callers use it to decide against retrying.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client reads resource tags from Azure Resource Graph. There is no interface here on purpose: the consumer declares the one-method seam it needs and this satisfies it.
func New ¶
New builds a client and verifies Resource Graph answers at all — a broken identity binding or a management group the identity cannot read fails here, at client build (a retryable hold), rather than silently per finding. Credentials come from the Azure default chain — Microsoft Entra Workload ID on AKS, workload identity federation elsewhere — so no key material exists anywhere.
func (*Client) Close ¶
Close releases nothing — the SDK client holds no connection of its own — and exists so the enhancer can treat every cloud client alike.
func (*Client) TagsFor ¶
TagsFor returns the tags of one resource, named by its ARM resource ID. The ID is an exact identifier — Resource Graph compares it case-insensitively, as ARM does — so there is no fallback search: a miss means the resource is unrecorded, not misspelled.
Errors are classified for the caller: ErrNotFound is final, everything else is worth retrying. That distinction is what lets the enhancer chain decide between advancing a finding and holding it for another try.