VSCode Azure SDK for Node.js - Azure Auth
This package provides a simple way to authenticate to Azure and receive Azure subscription information. It uses the built-in Microsoft Authentication extension and does not rely on the Azure Account extension in any way.
Azure Subscription Provider
The AzureSubscriptionProvider
interface describes the functions of this package.
export interface AzureSubscriptionProvider {
getTenants(): Promise<TenantIdDescription[]>;
getSubscriptions(filter: boolean): Promise<AzureSubscription[]>;
isSignedIn(tenantId?: string): Promise<boolean>;
signIn(tenantId?: string): Promise<boolean>;
onDidSignIn: vscode.Event<void>;
signOut(): Promise<void>;
onDidSignOut: vscode.Event<void>;
}
If the caller calls getSubscriptions()
when the user is not signed in, a NotSignedInError
will be thrown. You can check to see if a caught error is an instance of this error with isNotSignedInError()
.
Azure Cloud Configuration
Two methods are available for controlling the VSCode settings that determine what cloud is connected to when enumerating subscriptions.
export declare function getConfiguredAzureEnv(): azureEnv.Environment & {
isCustomCloud: boolean;
};
export declare function setConfiguredAzureEnv(cloud: string | azureEnv.EnvironmentParameters, target?: vscode.ConfigurationTarget): Promise<void>;
Logs
View the Microsoft Authentication extension logs by running the Developer: Show Logs...
command from the VS Code command palette.
Change the log level by running the Developer: Set Log Level...
command from the VS Code command palette. Select Microsoft Authentication
from the list of loggers and then select the desired log level.
License
MIT