Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/lib/azure/azurecredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ export const getManagementCredentials = async (
opts: AzureAccessOpts = {}
): Promise<msRestNodeAuth.ApplicationTokenCredentials | undefined> => {
// Load config from opts and fallback to spk config
const { azure } = Config().introspection!;
const conf = Config();
let servicePrincipalId = opts.servicePrincipalId;
let servicePrincipalPassword = opts.servicePrincipalPassword;
let tenantId = opts.tenantId;

const {
servicePrincipalId = azure && azure.service_principal_id,
servicePrincipalPassword = azure && azure.service_principal_secret,
tenantId = azure && azure.tenant_id
} = opts;
if (conf && conf.introspection && conf.introspection.azure) {
const azure = conf.introspection.azure;
servicePrincipalId = servicePrincipalId || azure.service_principal_id;
servicePrincipalPassword =
servicePrincipalPassword || azure.service_principal_secret;
tenantId = tenantId || azure.tenant_id;
}

if (
!verifyConfigDefined(servicePrincipalId, servicePrincipalPassword, tenantId)
Expand Down