mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 02:23:28 +08:00

* Use GetDefaultCloud from SDK * Use GetAzureCloud from SDK * Credentials parser moved to azmoncredentials * Refactor legacy credentials * Tests * Fix test description Co-authored-by: Andreas Christou <andreas.christou@grafana.com> --------- Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
17 lines
554 B
Go
17 lines
554 B
Go
package azmoncredentials
|
|
|
|
import (
|
|
"github.com/grafana/grafana-azure-sdk-go/azcredentials"
|
|
"github.com/grafana/grafana-azure-sdk-go/azsettings"
|
|
)
|
|
|
|
func GetDefaultCredentials(settings *azsettings.AzureSettings) azcredentials.AzureCredentials {
|
|
if settings.ManagedIdentityEnabled {
|
|
return &azcredentials.AzureManagedIdentityCredentials{}
|
|
} else if settings.WorkloadIdentityEnabled {
|
|
return &azcredentials.AzureWorkloadIdentityCredentials{}
|
|
} else {
|
|
return &azcredentials.AzureClientSecretCredentials{AzureCloud: settings.GetDefaultCloud()}
|
|
}
|
|
}
|