diff --git a/discovery/azure/azure.go b/discovery/azure/azure.go index ba71cc743..65cd00c6c 100644 --- a/discovery/azure/azure.go +++ b/discovery/azure/azure.go @@ -37,6 +37,8 @@ import ( const ( azureLabel = model.MetaLabelPrefix + "azure_" + azureLabelSubscriptionID = azureLabel + "subscription_id" + azureLabelTenantID = azureLabel + "tenant_id" azureLabelMachineID = azureLabel + "machine_id" azureLabelMachineResourceGroup = azureLabel + "machine_resource_group" azureLabelMachineName = azureLabel + "machine_name" @@ -332,6 +334,8 @@ func (d *Discovery) refresh() (tg *targetgroup.Group, err error) { } labels := model.LabelSet{ + azureLabelSubscriptionID: model.LabelValue(d.cfg.SubscriptionID), + azureLabelTenantID: model.LabelValue(d.cfg.TenantID), azureLabelMachineID: model.LabelValue(vm.ID), azureLabelMachineName: model.LabelValue(vm.Name), azureLabelMachineOSType: model.LabelValue(vm.OsType), diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 5b8b70ea4..545fa8394 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -267,6 +267,8 @@ The following meta labels are available on targets during relabeling: * `__meta_azure_machine_resource_group`: the machine's resource group * `__meta_azure_machine_tag_`: each tag value of the machine * `__meta_azure_machine_scale_set`: the name of the scale set which the vm is part of (this value is only set if you are using a [scale set](https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/)) +* `__meta_azure_subscription_id`: the subscription ID +* `__meta_azure_tenant_id`: the tenant ID See below for the configuration options for Azure discovery: