Skip to content

Commit

Permalink
Merge pull request #774 from shibayan/use-azure-cli-credential
Browse files Browse the repository at this point in the history
feat: Support Azure CLI credential
  • Loading branch information
Timothyw0 authored Jul 1, 2024
2 parents e5356d2 + f0aa902 commit 407464b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { StaticSiteARMResource, WebSiteManagementClient } from "@azure/arm-appse
import { GenericResourceExpanded, ResourceGroup, ResourceManagementClient } from "@azure/arm-resources";
import { Subscription, SubscriptionClient } from "@azure/arm-subscriptions";
import {
AzureCliCredential,
ChainedTokenCredential,
ClientSecretCredential,
DeviceCodeCredential,
Expand Down Expand Up @@ -62,8 +63,14 @@ export async function authenticateWithAzureIdentity(details: LoginDetails = {},

const environmentCredential = new EnvironmentCredential();

const azureCliCredential = new AzureCliCredential({
tenantId: details.tenantId,
});

// Only use interactive browser credential if we're not running in docker
const credentials = isRunningInDocker() ? [environmentCredential, deviceCredential] : [environmentCredential, browserCredential, deviceCredential];
const credentials = isRunningInDocker()
? [environmentCredential, azureCliCredential, deviceCredential]
: [environmentCredential, azureCliCredential, browserCredential, deviceCredential];

if (details.tenantId && details.clientId && details.clientSecret) {
const clientSecretCredential = new ClientSecretCredential(details.tenantId, details.clientId, details.clientSecret, {
Expand Down

0 comments on commit 407464b

Please sign in to comment.