Skip to content

Commit

Permalink
Enable Azure MSI authentication for ARO HCP
Browse files Browse the repository at this point in the history
For ARO HCP, we need to override the authentication type to be MSI. For more information please see openshift/enhancements#1659.
  • Loading branch information
bryan-cox committed Aug 5, 2024
1 parent a01ed6c commit 1764dd2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/dns/azure/client/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ func getAuthorizerForResource(config Config) (autorest.Authorizer, error) {
}

var cred azcore.TokenCredential
if config.AzureWorkloadIdentityEnabled && strings.TrimSpace(config.ClientSecret) == "" {
// MSI Override for ARO HCP
msi := os.Getenv("AZURE_MSI_AUTHENTICATION")
if msi == "true" {
options := azidentity.ManagedIdentityCredentialOptions{
ClientOptions: azcore.ClientOptions{
Cloud: cloudConfig,
},
}

var err error
cred, err = azidentity.NewManagedIdentityCredential(&options)
if err != nil {
return nil, err
}
} else if config.AzureWorkloadIdentityEnabled && strings.TrimSpace(config.ClientSecret) == "" {
options := azidentity.WorkloadIdentityCredentialOptions{
ClientOptions: azcore.ClientOptions{
Cloud: cloudConfig,
Expand Down

0 comments on commit 1764dd2

Please sign in to comment.