azure-search-openai-demo
azure-search-openai-demo copied to clipboard
Update prepdocs hook to use AzureDeveloperCliCredential
The prepdocs
hook uses DefaultAzureCredential
, which might incorrectly use another source of auth for Azure.
For example, DAC might use an environment credential that is set within the system, or the default account set for the Azure CLI
, if az
was previously login.
This change makes sure that the hook uses the same auth that was used when provisioning the template, by calling azd
for an auth token.
The TenantId
is important to support accounts with access to multiple tenants, as azd
would return home-tenant
if no tenant id is provided.