in src/login/environments.ts [55:104]
export async function getEnvironments(includePartial: boolean = false): Promise<Environment[]> {
const metadataDiscoveryUrl: string | undefined = process.env['ARM_CLOUD_METADATA_URL'];
if (metadataDiscoveryUrl) {
try {
const response: Response = await fetch(metadataDiscoveryUrl);
if (response.ok) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const endpoints: ICloudMetadata[] = await response.json();
return endpoints.map(endpoint => {
return {
name: endpoint.name,
portalUrl: endpoint.portal,
managementEndpointUrl: endpoint.authentication.audiences[0],
resourceManagerEndpointUrl: endpoint.resourceManager,
activeDirectoryEndpointUrl: endpoint.authentication.loginEndpoint,
activeDirectoryResourceId: endpoint.authentication.audiences[0],
sqlManagementEndpointUrl: endpoint.sqlManagement,
sqlServerHostnameSuffix: endpoint.suffixes.sqlServerHostname,
galleryEndpointUrl: endpoint.gallery,
batchResourceId: endpoint.batch,
storageEndpointSuffix: endpoint.suffixes.storage,
keyVaultDnsSuffix: endpoint.suffixes.keyVaultDns,
validateAuthority: true
}
})
}
} catch {
// ignore, fallback to static environments
}
}
const result: Environment[] = [...staticEnvironments]; // make a clone
const config: WorkspaceConfiguration = workspace.getConfiguration(extensionPrefix);
const ppe: Environment | undefined = config.get(ppeSetting);
if (ppe) {
result.push({
...ppe,
name: azurePPE,
validateAuthority: getValidateAuthority(ppe.activeDirectoryEndpointUrl)
});
}
const customCloudEnvironment: Environment | undefined = await getCustomCloudEnvironment(config, includePartial);
if (customCloudEnvironment) {
result.push(customCloudEnvironment);
}
return result;
}