private async connectedToCloudShell()

in src/cloudShell.ts [172:206]


    private async connectedToCloudShell(): Promise<boolean> {
        if (this.terminal) {
            return true;
        }

        const message = "Do you want to open CloudShell?";
        const response: MessageItem = await vscode.window.showWarningMessage(message, DialogOption.ok, DialogOption.cancel);
        if (response === DialogOption.ok) {
            // TODO: Azure Account API is deprecated and need to be replaced once support for Azure Account API is migrated.
            const accountAPI: AzureAccount = vscode.extensions
                .getExtension<AzureAccount>("ms-vscode.azure-account")!.exports;

            this.cloudShell =  accountAPI.createCloudShell("Linux");

            this.terminal = await this.cloudShell.terminal;
            this.terminal.show();
            const storageAccount: IStorageAccount = await getStorageAccountforCloudShell(this.cloudShell);
            if (!storageAccount) {
                vscode.window.showErrorMessage("Failed to get the Storage Account information for Cloud Shell, please try again later.");
                return false;
            }

            this.resourceGroup = storageAccount.resourceGroup;
            this.storageAccountName = storageAccount.storageAccountName;
            this.storageAccountKey = storageAccount.storageAccountKey;
            this.fileShareName = storageAccount.fileShareName;

            terraformChannel.appendLine("Cloudshell terminal opened.");

            return true;
        }

        console.log("Open CloudShell cancelled by user.");
        return false;
    }