|
|
|
@ -54,12 +54,12 @@ if (process.env["AZURE_ADAL_LOGGING_ENABLED"]) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @interface AzureTokenCredentialsOptions - Describes optional parameters for serviceprincipal/secret authentication.
|
|
|
|
|
* @interface AzureTokenCredentialsOptions - Describes optional parameters for servicePrincipal/secret authentication.
|
|
|
|
|
*/
|
|
|
|
|
export interface AzureTokenCredentialsOptions {
|
|
|
|
|
/**
|
|
|
|
|
* @property {TokenAudience} [tokenAudience] - The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
*/
|
|
|
|
|
tokenAudience?: TokenAudience;
|
|
|
|
|
/**
|
|
|
|
@ -83,7 +83,7 @@ export interface LoginWithUsernamePasswordOptions extends AzureTokenCredentialsO
|
|
|
|
|
*/
|
|
|
|
|
clientId?: string;
|
|
|
|
|
/**
|
|
|
|
|
* @property {string} [domain] - The domain or tenant id containing this application. Default value is "common".
|
|
|
|
|
* @property {string} [domain] - The domain or tenant Id containing this application. Default value is "common".
|
|
|
|
|
*/
|
|
|
|
|
domain?: string;
|
|
|
|
|
}
|
|
|
|
@ -112,7 +112,7 @@ export interface AuthResponse {
|
|
|
|
|
*/
|
|
|
|
|
credentials: TokenCredentialsBase;
|
|
|
|
|
/**
|
|
|
|
|
* @property {Array<LinkedSubscription>} [subscriptions] List of associated subscriptions.
|
|
|
|
|
* @property {Array<LinkedSubscription>} [subscriptions] List of associated subscriptions. It will be empty for personal accounts, unless the login method is called with a tenant Id sent as the `domain` optional parameter.
|
|
|
|
|
*/
|
|
|
|
|
subscriptions?: LinkedSubscription[];
|
|
|
|
|
}
|
|
|
|
@ -144,6 +144,8 @@ export type Callback<TResult> = (error?: Error, result?: TResult) => void;
|
|
|
|
|
* Provides a UserTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
* This method is applicable only for organizational ids that are not 2FA enabled otherwise please use interactive login.
|
|
|
|
|
*
|
|
|
|
|
* When using personal accounts, the `domain` property in the `options` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} username The user name for the Organization Id account.
|
|
|
|
|
* @param {string} password The password for the Organization Id account.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
@ -151,12 +153,12 @@ export type Callback<TResult> = (error?: Error, result?: TResult) => void;
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant id containing this application. Default value "common".
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant Id containing this application. Default value "common".
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse that contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse, which contains `credentials` and an optional `subscriptions` array, and rejects with an Error.
|
|
|
|
|
*/
|
|
|
|
|
export async function withUsernamePasswordWithAuthResponse(username: string, password: string, options?: LoginWithUsernamePasswordOptions): Promise<AuthResponse> {
|
|
|
|
|
if (!options) {
|
|
|
|
@ -175,7 +177,7 @@ export async function withUsernamePasswordWithAuthResponse(username: string, pas
|
|
|
|
|
const creds = new UserTokenCredentials(options.clientId, options.domain, username, password, options.tokenAudience, options.environment);
|
|
|
|
|
await creds.getToken();
|
|
|
|
|
|
|
|
|
|
// The token cache gets propulated for all the tenants as a part of building the tenantList.
|
|
|
|
|
// The token cache gets populated for all the tenants as a part of building the tenantList.
|
|
|
|
|
const tenantList = await buildTenantList(creds);
|
|
|
|
|
const subscriptionList: LinkedSubscription[] = await _getSubscriptions(creds, tenantList, options.tokenAudience);
|
|
|
|
|
|
|
|
|
@ -183,20 +185,22 @@ export async function withUsernamePasswordWithAuthResponse(username: string, pas
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides an ApplicationTokenCredentials object and the list of subscriptions associated with that servicePrinicpalId/clientId across all the applicable tenants.
|
|
|
|
|
* Provides an ApplicationTokenCredentials object and the list of subscriptions associated with that servicePrincipalId/clientId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* When using personal accounts, the `domain` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client Id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} secret The application secret for the service principal.
|
|
|
|
|
* @param {string} domain The domain or tenant id containing this application.
|
|
|
|
|
* @param {string} domain The domain or tenant Id containing this application.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse that contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse, which contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
*/
|
|
|
|
|
export async function withServicePrincipalSecretWithAuthResponse(clientId: string, secret: string, domain: string, options?: AzureTokenCredentialsOptions): Promise<AuthResponse> {
|
|
|
|
|
if (!options) {
|
|
|
|
@ -215,22 +219,24 @@ export async function withServicePrincipalSecretWithAuthResponse(clientId: strin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides an ApplicationTokenCertificateCredentials object and the list of subscriptions associated with that servicePrinicpalId/clientId across all the applicable tenants.
|
|
|
|
|
* Provides an ApplicationTokenCertificateCredentials object and the list of subscriptions associated with that servicePrincipalId/clientId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* When using personal accounts, the `domain` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client Id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} certificateStringOrFilePath A PEM encoded certificate and private key OR an absolute filepath to the .pem file containing that information. For example:
|
|
|
|
|
* - CertificateString: "-----BEGIN PRIVATE KEY-----\n<xxxxx>\n-----END PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\n<yyyyy>\n-----END CERTIFICATE-----\n"
|
|
|
|
|
* - CertificateFilePath: **Absolute** file path of the .pem file.
|
|
|
|
|
* @param {string} domain The domain or tenant id containing this application.
|
|
|
|
|
* @param {string} domain The domain or tenant Id containing this application.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse that contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse, which contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
*/
|
|
|
|
|
export async function withServicePrincipalCertificateWithAuthResponse(clientId: string, certificateStringOrFilePath: string, domain: string, options?: AzureTokenCredentialsOptions): Promise<AuthResponse> {
|
|
|
|
|
if (!options) {
|
|
|
|
@ -318,7 +324,7 @@ function foundManagementEndpointUrl(authFileUrl: string, envUrl: string): boolea
|
|
|
|
|
* name. Default is "AZURE_SUBSCRIPTION_ID".
|
|
|
|
|
* @param {function} [optionalCallback] The optional callback.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse that contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse, which contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
*/
|
|
|
|
|
export async function withAuthFileWithAuthResponse(options?: LoginWithAuthFileOptions): Promise<AuthResponse> {
|
|
|
|
|
if (!options) options = { filePath: "" };
|
|
|
|
@ -391,8 +397,9 @@ export async function withAuthFileWithAuthResponse(options?: LoginWithAuthFileOp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides a url and code that needs to be copy and pasted in a browser and authenticated over there. If successful, the user will get a
|
|
|
|
|
* DeviceTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
* Provides a url and code that needs to be copy and pasted in a browser and authenticated over there. If successful, the user will get a DeviceTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* When using personal accounts, the `domain` property in the `options` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
*
|
|
|
|
@ -401,9 +408,9 @@ export async function withAuthFileWithAuthResponse(options?: LoginWithAuthFileOp
|
|
|
|
|
* for an example.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid value is "graph".If tokenAudience is provided
|
|
|
|
|
* then domain should also be provided its value should not be the default "common" tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* then domain should also be provided its value should not be the default "common" tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
*
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant id containing this application. Default value is "common".
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant Id containing this application. Default value is "common".
|
|
|
|
|
*
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with. Default environment is "Public Azure".
|
|
|
|
|
*
|
|
|
|
@ -416,7 +423,7 @@ export async function withAuthFileWithAuthResponse(options?: LoginWithAuthFileOp
|
|
|
|
|
*
|
|
|
|
|
* @param {function} [optionalCallback] The optional callback.
|
|
|
|
|
*
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse that contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
* @returns {Promise<AuthResponse>} A Promise that resolves to AuthResponse, which contains "credentials" and optional "subscriptions" array and rejects with an Error.
|
|
|
|
|
*/
|
|
|
|
|
export async function withInteractiveWithAuthResponse(options?: InteractiveLoginOptions): Promise<AuthResponse> {
|
|
|
|
|
if (!options) {
|
|
|
|
@ -572,16 +579,17 @@ export function withAuthFile(options?: LoginWithAuthFileOptions, callback?: { (e
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides a url and code that needs to be copy and pasted in a browser and authenticated over there. If successful, the user will get a
|
|
|
|
|
* DeviceTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
* Provides a url and code that needs to be copy and pasted in a browser and authenticated over there. If successful, the user will get a DeviceTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* When using personal accounts, the `domain` property in the `options` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
* @param {string} [options.clientId] The active directory application client id.
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid value is "graph".If tokenAudience is provided
|
|
|
|
|
* then domain should also be provided its value should not be the default "common" tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant id containing this application. Default value is "common".
|
|
|
|
|
* then domain should also be provided its value should not be the default "common" tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant Id containing this application. Default value is "common".
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with. Default environment is "Public Azure".
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
* @param {object} [options.language] The language code specifying how the message should be localized to. Default value "en-us".
|
|
|
|
@ -592,9 +600,9 @@ export function withAuthFile(options?: LoginWithAuthFileOptions, callback?: { (e
|
|
|
|
|
* @returns {function | Promise} If a callback was passed as the last parameter then it returns the callback else returns a Promise.
|
|
|
|
|
*
|
|
|
|
|
* {function} optionalCallback(err, credentials)
|
|
|
|
|
* {Error} [err] - The Error object if an error occurred, null otherwise.
|
|
|
|
|
* {DeviceTokenCredentials} [credentials] - The DeviceTokenCredentials object.
|
|
|
|
|
* {Array} [subscriptions] - List of associated subscriptions across all the applicable tenants.
|
|
|
|
|
* {Error} [err] - The Error object if an error occurred, null otherwise.
|
|
|
|
|
* {DeviceTokenCredentials} [credentials] - The DeviceTokenCredentials object.
|
|
|
|
|
* {Array} [subscriptions] - List of associated subscriptions across all the applicable tenants.
|
|
|
|
|
* {Promise} A promise is returned.
|
|
|
|
|
* @resolve {DeviceTokenCredentials} The DeviceTokenCredentials object.
|
|
|
|
|
* @reject {Error} - The error object.
|
|
|
|
@ -624,16 +632,18 @@ export function interactive(options?: InteractiveLoginOptions, callback?: { (err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides an ApplicationTokenCredentials object and the list of subscriptions associated with that servicePrinicpalId/clientId across all the applicable tenants.
|
|
|
|
|
* Provides an ApplicationTokenCredentials object and the list of subscriptions associated with that servicePrincipalId/clientId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* When using personal accounts, the `domain` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client Id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} secret The application secret for the service principal.
|
|
|
|
|
* @param {string} domain The domain or tenant id containing this application.
|
|
|
|
|
* @param {string} domain The domain or tenant Id containing this application.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
* @param {function} [optionalCallback] The optional callback.
|
|
|
|
@ -641,9 +651,9 @@ export function interactive(options?: InteractiveLoginOptions, callback?: { (err
|
|
|
|
|
* @returns {function | Promise} If a callback was passed as the last parameter then it returns the callback else returns a Promise.
|
|
|
|
|
*
|
|
|
|
|
* {function} optionalCallback(err, credentials)
|
|
|
|
|
* {Error} [err] - The Error object if an error occurred, null otherwise.
|
|
|
|
|
* {Error} [err] - The Error object if an error occurred, null otherwise.
|
|
|
|
|
* {ApplicationTokenCredentials} [credentials] - The ApplicationTokenCredentials object.
|
|
|
|
|
* {Array} [subscriptions] - List of associated subscriptions across all the applicable tenants.
|
|
|
|
|
* {Array} [subscriptions] - List of associated subscriptions across all the applicable tenants.
|
|
|
|
|
* {Promise} A promise is returned.
|
|
|
|
|
* @resolve {ApplicationTokenCredentials} The ApplicationTokenCredentials object.
|
|
|
|
|
* @reject {Error} - The error object.
|
|
|
|
@ -673,18 +683,20 @@ export function withServicePrincipalSecret(clientId: string, secret: string, dom
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides an ApplicationTokenCertificateCredentials object and the list of subscriptions associated with that servicePrinicpalId/clientId across all the applicable tenants.
|
|
|
|
|
* Provides an ApplicationTokenCertificateCredentials object and the list of subscriptions associated with that servicePrincipalId/clientId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* When using personal accounts, the `domain` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} clientId The active directory application client Id also known as the SPN (ServicePrincipal Name).
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} certificateStringOrFilePath A PEM encoded certificate and private key OR an absolute filepath to the .pem file containing that information. For example:
|
|
|
|
|
* - CertificateString: "-----BEGIN PRIVATE KEY-----\n<xxxxx>\n-----END PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\n<yyyyy>\n-----END CERTIFICATE-----\n"
|
|
|
|
|
* - CertificateFilePath: **Absolute** file path of the .pem file.
|
|
|
|
|
* @param {string} domain The domain or tenant id containing this application.
|
|
|
|
|
* @param {string} domain The domain or tenant Id containing this application.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
* @param {function} [optionalCallback] The optional callback.
|
|
|
|
@ -725,8 +737,11 @@ export function withServicePrincipalCertificate(clientId: string, certificateStr
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides a UserTokenCredentials object and the list of subscriptions associated with that userId across all the applicable tenants.
|
|
|
|
|
*
|
|
|
|
|
* This method is applicable only for organizational ids that are not 2FA enabled otherwise please use interactive login.
|
|
|
|
|
*
|
|
|
|
|
* When using personal accounts, the `domain` property in the `options` parameter is required to be set to the Id of a tenant for that account. Otherwise, the resulting credential will not be able to access the account's resources.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} username The user name for the Organization Id account.
|
|
|
|
|
* @param {string} password The password for the Organization Id account.
|
|
|
|
|
* @param {object} [options] Object representing optional parameters.
|
|
|
|
@ -734,8 +749,8 @@ export function withServicePrincipalCertificate(clientId: string, certificateStr
|
|
|
|
|
* See {@link https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-dotnet/ Active Directory Quickstart for .Net}
|
|
|
|
|
* for an example.
|
|
|
|
|
* @param {string} [options.tokenAudience] The audience for which the token is requested. Valid values are 'graph', 'batch', or any other resource like 'https://vault.azure.net/'.
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferrably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant id containing this application. Default value "common".
|
|
|
|
|
* If tokenAudience is 'graph' then domain should also be provided and its value should not be the default 'common' tenant. It must be a string (preferably in a guid format).
|
|
|
|
|
* @param {string} [options.domain] The domain or tenant Id containing this application. Default value "common".
|
|
|
|
|
* @param {Environment} [options.environment] The azure environment to authenticate with.
|
|
|
|
|
* @param {object} [options.tokenCache] The token cache. Default value is the MemoryCache object from adal.
|
|
|
|
|
* @param {function} [optionalCallback] The optional callback.
|
|
|
|
@ -940,7 +955,7 @@ export async function execAz(cmd: string): Promise<any> {
|
|
|
|
|
try {
|
|
|
|
|
return resolve(JSON.parse(stdout));
|
|
|
|
|
} catch (err) {
|
|
|
|
|
const msg = `An error occured while parsing the output "${stdout}", of ` +
|
|
|
|
|
const msg = `An error occurred while parsing the output "${stdout}", of ` +
|
|
|
|
|
`the cmd "${cmd}": ${err.stack}.`;
|
|
|
|
|
return reject(new Error(msg));
|
|
|
|
|
}
|
|
|
|
|