[docs] Document ITokenCredentialProvider for reusing Aspire's Azure credential - #1527
Conversation
…edential Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
| ## Reuse the credential in custom code | ||
|
|
||
| Integrations and app host code outside of `Aspire.Hosting.Azure`—for example, a pipeline step, lifecycle hook, or custom resource—can resolve the same `TokenCredential` that Aspire's Azure hosting integrations use for provisioning and Azure API calls. Resolve `ITokenCredentialProvider` from dependency injection and read its `TokenCredential` property: |
There was a problem hiding this comment.
Use "AppHost" instead of "app host".
| Integrations and app host code outside of `Aspire.Hosting.Azure`—for example, a pipeline step, lifecycle hook, or custom resource—can resolve the same `TokenCredential` that Aspire's Azure hosting integrations use for provisioning and Azure API calls. Resolve `ITokenCredentialProvider` from dependency injection and read its `TokenCredential` property: | |
| Integrations and AppHost code outside of `Aspire.Hosting.Azure`—for example, a pipeline step, lifecycle hook, or custom resource—can resolve the same `TokenCredential` that Aspire's Azure hosting integrations use for provisioning and Azure API calls. Resolve `ITokenCredentialProvider` from dependency injection and read its `TokenCredential` property: |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2fc23d00-db43-47fd-a3aa-290b772db576
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2fc23d00-db43-47fd-a3aa-290b772db576
There was a problem hiding this comment.
Pull request overview
Adds documentation for the newly public ITokenCredentialProvider so AppHost/custom integration code can reuse the same Azure TokenCredential that Aspire’s Azure hosting/provisioning uses.
Changes:
- Adds a “Reuse the credential in custom code” section describing resolving
ITokenCredentialProviderfrom DI and consuming itsTokenCredential. - Documents how the provider is registered (via
AddAzureProvisioning, including indirect registration via Azure resource extension methods). - Notes that consumers can replace the
ITokenCredentialProviderregistration with a custom implementation.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2fc23d00-db43-47fd-a3aa-290b772db576
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/frontend/src/content/docs/integrations/cloud/azure/azure-default-credential.mdx:79
- PR description says this new section notes that the
ITokenCredentialProvidersingleton registration viaAddAzureProvisioningis also reached indirectly viaAddAzureEnvironment, but the doc only mentions Azure resource extension methods. Either update the PR description to match the actual doc change, or (if intended and accurate) update this paragraph to also mentionAddAzureEnvironment.
`ITokenCredentialProvider` is registered as a singleton by `AddAzureProvisioning`. Azure resource extension methods invoke `AddAzureProvisioning`, so using those methods registers the provider indirectly. The credential it exposes is configured by the same Azure provisioning options (tenant ID, credential source, and so on) and matched to the current run or publish execution context, as described in [Default credential behavior](#default-credential-behavior).
Documents changes from microsoft/aspire#17387
@eerhardtTargeting
release/13.5— the latest release branch onmicrosoft/aspire.dev— becauserelease/13.4(from the source PR milestone13.4) does not exist there.Why
microsoft/aspire#17387 makes
ITokenCredentialProviderpublic so integrations and AppHost code outside ofAspire.Hosting.Azurecan resolve the sameTokenCredentialthat Aspire's Azure hosting integrations use for provisioning and Azure API calls. This is a new public type (new_public_typesignal) with an explicit "User-facing usage" section in the PR body (pr_body_has_user_facing_sectionsignal), so it needs to be documented.Changes
src/frontend/src/content/docs/integrations/cloud/azure/azure-default-credential.mdxwith a new "Reuse the credential in custom code" section that:ITokenCredentialProviderfrom DI and use itsTokenCredentialproperty.AddAzureProvisioning, including indirect registration through Azure resource extension methods that invoke it.No new pages were created; this is an addition to an existing, closely related page.