go-azure-sdk
go-azure-sdk copied to clipboard
Support MSI authentication in Azure Container App and App Service like environments
Fixes #1054
This pull request introduces changes to the managed_identity_authorizer.go
file to enhance support for Azure App Service environments. The most important changes include adding environment variable checks for MSI_ENDPOINT
and MSI_SECRET
, updating the managedIdentityConfig
struct, and modifying the azureMetadata
function to include the IDENTITY_HEADER
if it is set.
Enhancements for Azure App Service environments:
-
sdk/auth/managed_identity_authorizer.go
: Added environment variable checks forMSI_ENDPOINT
andMSI_SECRET
to use a custom endpoint and a newer API version if these variables are present. ([sdk/auth/managed_identity_authorizer.goR141-R157](diffhunk://#diff-34bbc13c23439cbbb815afe5de29f488cbd66a126f2ad0785bd62bdf5ef71667R141-R157)
) -
sdk/auth/managed_identity_authorizer.go
: Modified themanagedIdentityConfig
struct to dynamically set theMsiApiVersion
andMsiEndpoint
based on environment variables. ([sdk/auth/managed_identity_authorizer.goR141-R157](diffhunk://#diff-34bbc13c23439cbbb815afe5de29f488cbd66a126f2ad0785bd62bdf5ef71667R141-R157)
) -
sdk/auth/managed_identity_authorizer.go
: Updated theazureMetadata
function to include theIDENTITY_HEADER
in the request headers if the environment variable is set. ([sdk/auth/managed_identity_authorizer.goL165-R191](diffhunk://#diff-34bbc13c23439cbbb815afe5de29f488cbd66a126f2ad0785bd62bdf5ef71667L165-R191)
)
General improvements:
-
sdk/auth/managed_identity_authorizer.go
: Added theos
package to the import list to support the new environment variable checks. ([sdk/auth/managed_identity_authorizer.goR14](diffhunk://#diff-34bbc13c23439cbbb815afe5de29f488cbd66a126f2ad0785bd62bdf5ef71667R14)
)