7e0d8c3556
* Azure: Settings for Azure AD Workload Identity (#75283)
* Settings for Azure AD Workload Identity
* Update dependency on Grafana Azure SDK
* Documentation
* Fix JS code
* Cleanup Prometheus backend code
* Making prettier happy
(cherry picked from commit 3ee40d3a5a)
# Conflicts:
# conf/defaults.ini
# conf/sample.ini
# docs/sources/setup-grafana/configure-grafana/_index.md
# go.mod
# go.sum
# packages/grafana-runtime/src/config.ts
# pkg/api/dtos/frontend_settings.go
# pkg/api/frontendsettings.go
# pkg/setting/setting_azure.go
# public/app/plugins/datasource/mssql/azureauth/AzureAuth.testMocks.ts
* Fix build
---------
Co-authored-by: Sergey Kostrukov <sekost@microsoft.com>
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package setting
|
|
|
|
import "github.com/grafana/grafana-azure-sdk-go/azsettings"
|
|
|
|
func (cfg *Cfg) readAzureSettings() {
|
|
azureSettings := &azsettings.AzureSettings{}
|
|
|
|
azureSection := cfg.Raw.Section("azure")
|
|
|
|
// Cloud
|
|
cloudName := azureSection.Key("cloud").MustString(azsettings.AzurePublic)
|
|
azureSettings.Cloud = azsettings.NormalizeAzureCloud(cloudName)
|
|
|
|
// Managed Identity
|
|
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
|
|
}
|