Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit d8f290c

Browse files
authored
Attempt to fix on board error (2nd Attempt) (#424)
* attempt to fix introspection test failure * Update azurecredentials.ts
1 parent 6398bbf commit d8f290c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/lib/azure/azurecredentials.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ export const getManagementCredentials = async (
4242
opts: AzureAccessOpts = {}
4343
): Promise<msRestNodeAuth.ApplicationTokenCredentials | undefined> => {
4444
// Load config from opts and fallback to spk config
45-
const { azure } = Config().introspection!;
45+
const conf = Config();
46+
let servicePrincipalId = opts.servicePrincipalId;
47+
let servicePrincipalPassword = opts.servicePrincipalPassword;
48+
let tenantId = opts.tenantId;
4649

47-
const {
48-
servicePrincipalId = azure && azure.service_principal_id,
49-
servicePrincipalPassword = azure && azure.service_principal_secret,
50-
tenantId = azure && azure.tenant_id
51-
} = opts;
50+
if (conf && conf.introspection && conf.introspection.azure) {
51+
const azure = conf.introspection.azure;
52+
servicePrincipalId = servicePrincipalId || azure.service_principal_id;
53+
servicePrincipalPassword =
54+
servicePrincipalPassword || azure.service_principal_secret;
55+
tenantId = tenantId || azure.tenant_id;
56+
}
5257

5358
if (
5459
!verifyConfigDefined(servicePrincipalId, servicePrincipalPassword, tenantId)

0 commit comments

Comments
 (0)