in common-npm-packages/AzureRmDeploy-common-v3/azure-arm-rest/azure-arm-common.ts [26:87]
constructor(clientId: string, domain: string, secret: string, baseUrl: string, authorityUrl: string, activeDirectoryResourceId: string, isAzureStackEnvironment: boolean, scheme?: string, msiClientId?: string, authType?: string, certFilePath?: string, isADFSEnabled?: boolean) {
if (!Boolean(domain) || typeof domain.valueOf() !== 'string') {
throw new Error(tl.loc("DomainCannotBeEmpty"));
}
if((!scheme ||scheme ==='ServicePrincipal')){
if (!Boolean(clientId) || typeof clientId.valueOf() !== 'string') {
throw new Error(tl.loc("ClientIdCannotBeEmpty"));
}
if(!authType || authType == constants.AzureServicePrinicipalAuthentications.servicePrincipalKey) {
if (!Boolean(secret) || typeof secret.valueOf() !== 'string') {
throw new Error(tl.loc("SecretCannotBeEmpty"));
}
}
else {
if (!Boolean(certFilePath) || typeof certFilePath.valueOf() !== 'string') {
throw new Error(tl.loc("InvalidCertFileProvided"));
}
}
}
if (!Boolean(baseUrl) || typeof baseUrl.valueOf() !== 'string') {
throw new Error(tl.loc("armUrlCannotBeEmpty"));
}
if (!Boolean(authorityUrl) || typeof authorityUrl.valueOf() !== 'string') {
throw new Error(tl.loc("authorityUrlCannotBeEmpty"));
}
if (!Boolean(activeDirectoryResourceId) || typeof activeDirectoryResourceId.valueOf() !== 'string') {
throw new Error(tl.loc("activeDirectoryResourceIdUrlCannotBeEmpty"));
}
if(!Boolean(isAzureStackEnvironment) || typeof isAzureStackEnvironment.valueOf() != 'boolean') {
isAzureStackEnvironment = false;
}
this.clientId = clientId;
this.domain = domain;
this.baseUrl = baseUrl;
this.authorityUrl = authorityUrl;
this.activeDirectoryResourceId = activeDirectoryResourceId;
this.isAzureStackEnvironment = isAzureStackEnvironment;
this.scheme = scheme ? AzureModels.Scheme[scheme] : AzureModels.Scheme['ServicePrincipal'] ;
this.msiClientId = msiClientId ;
if(this.scheme == AzureModels.Scheme['ServicePrincipal']) {
this.authType = authType ? authType : constants.AzureServicePrinicipalAuthentications.servicePrincipalKey;
if(this.authType == constants.AzureServicePrinicipalAuthentications.servicePrincipalKey) {
this.secret = secret;
}
else {
this.certFilePath = certFilePath;
}
}
this.isADFSEnabled = isADFSEnabled;
}