Skip to content

Commit

Permalink
Refactor managed identity authorizer to include custom managed identi…
Browse files Browse the repository at this point in the history
…ty endpoint
  • Loading branch information
hc-github-team-tf-azure committed Oct 9, 2024
1 parent d1676a8 commit 6000ee7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sdk/auth/managed_identity_authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ type managedIdentityConfig struct {
// clientId and objectId can be left blank when a single managed identity is available
func newManagedIdentityConfig(resource, clientId, customManagedIdentityEndpoint string) (*managedIdentityConfig, error) {
endpoint := msiDefaultEndpoint
if customManagedIdentityEndpoint != "" {
endpoint = customManagedIdentityEndpoint
}

// If MSI_ENDPOINT and MSI_SECRET are present then we are running in Azure APP Service like environment.
// In this case, we need to use the MSI_ENDPOINT and newer version of API.
Expand All @@ -150,6 +147,10 @@ func newManagedIdentityConfig(resource, clientId, customManagedIdentityEndpoint
apiVersion = "2019-08-01"
}

if customManagedIdentityEndpoint != "" {
endpoint = customManagedIdentityEndpoint
}

return &managedIdentityConfig{
ClientID: clientId,
Resource: resource,
Expand Down

0 comments on commit 6000ee7

Please sign in to comment.