Fix Endpoint Selection for Azure MSI Authentication - #1813
Open
nickblantz wants to merge 1 commit into
Open
Conversation
|
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes Azure managed identity authentication select the endpoint and request protocol exposed by the host environment instead of always calling IMDS. This enables
azure-msiauthentication to use host-specific endpoints such as Azure Function App while preserving IMDS as the fallback.Why
AzureMsiCredentialscurrently assumes every managed identity is available from the VM IMDS endpoint at169.254.169.254. Azure exposes different endpoints, headers, parameters, and token response formats on other hosting platforms, so workloads usingARM_USE_MSI=trueoutside an IMDS environment cannot acquire tokens through the SDK.Microsoft's
ManagedIdentityCredentialdetects the hosting environment from Azure-provided environment variables and selects the corresponding credential in a defined order. This change follows that selection order and implements each selected endpoint's request contract, using IMDS only when no more specific environment is configured.What changed
Interface changes
None. The
NewAzureMsiTokenSourcesignature and existingConfigfields remain unchanged.Behavioral changes
AZURE_POD_IDENTITY_AUTHORITY_HOSTwhen IMDS is selected.WWW-Authenticate, validating its platform-specific directory,.keyextension, and 4096-byte size limit, and retrying with Basic authorization.expires_onvalues, relativeexpires_invalues, and the Linux and Windows datetime formats returned by Azure ML.Internal changes
io.Reader.How is this tested?
Unit tests cover endpoint selection and request construction. End-to-end validation remains for the target Azure Function App environment and an Azure Virtual Machine regression check for the existing IMDS flow.
'^(TestMsi|TestAzureMsi|TestAzureArc|TestParseAzureML|TestReadAzureArc)'Pulumi → Databricks Terraform Provider → Databricks Go SDKrunning from Azure Function AppDatabricks Terraform Provider → Databricks Go SDKrunning from Azure Virtual MachineChanges in this pull request were written primarily with Codex and the following prompt: