[v9.5.x] Azure: Settings for Azure AD Workload Identity (#75690)

* Backport workload identity changes

* Tidy go.mod

* Add missing flag
This commit is contained in:
Andreas Christou
2023-09-29 10:06:03 +01:00
committed by GitHub
parent 9038465a82
commit b52b829ece
11 changed files with 109 additions and 53 deletions
+18
View File
@@ -15,5 +15,23 @@ func (cfg *Cfg) readAzureSettings() {
azureSettings.ManagedIdentityEnabled = azureSection.Key("managed_identity_enabled").MustBool(false)
azureSettings.ManagedIdentityClientId = azureSection.Key("managed_identity_client_id").String()
// Workload Identity authentication
if azureSection.Key("workload_identity_enabled").MustBool(false) {
azureSettings.WorkloadIdentityEnabled = true
workloadIdentitySettings := &azsettings.WorkloadIdentitySettings{}
if val := azureSection.Key("workload_identity_tenant_id").String(); val != "" {
workloadIdentitySettings.TenantId = val
}
if val := azureSection.Key("workload_identity_client_id").String(); val != "" {
workloadIdentitySettings.ClientId = val
}
if val := azureSection.Key("workload_identity_token_file").String(); val != "" {
workloadIdentitySettings.TokenFile = val
}
azureSettings.WorkloadIdentitySettings = workloadIdentitySettings
}
cfg.Azure = azureSettings
}