用于 IntelliJ 的 Azure 工具包的登录说明Sign-in instructions for the Azure Toolkit for IntelliJ

安装后,Azure Toolkit for IntelliJ 提供两种登录 Azure 帐户的方法:Once installed, the Azure Toolkit for IntelliJ provides two methods for signing in to your Azure account:

还提供了注销方法。Sign out methods are also provided.

先决条件Prerequisites

若要完成文章中的步骤,需要安装用于 IntelliJ 的 Azure 工具包,该工具包需要以下软件组件:To complete the steps in his article, you will need to install the Azure Toolkit for IntelliJ, which requires the following software components:

备注

JetBrains 插件存储库中的 Azure Toolkit for IntelliJ 页列出了与该工具包兼容的内部版本。The Azure Toolkit for IntelliJ page at the JetBrains Plugin Repository lists the builds that are compatible with the toolkit.

通过设备登录名登录到 Azure 帐户Sign in to your Azure account by Device Login

若要通过设备登录名登录 Azure,请执行以下操作:To sign in Azure by device login, do the following:

  1. 使用 IntelliJ IDEA 打开项目。Open your project with IntelliJ IDEA.

  2. 打开边栏中的“Azure 资源管理器”,然后单击顶部栏中的“Azure 登录”图标(或者在 IDEA 菜单中选择“工具”>“Azure”>“Azure 登录”)。 Open sidebar Azure Explorer, and then click the Azure Sign In icon in the bar on top (or from IDEA menu Tools/Azure/Azure Sign in).

    “IntelliJ Azure 登录”命令

  3. 在“Azure 登录”窗口中选择“设备登录名”,然后单击“登录”。 In the Azure Sign In window, select Device Login, and then click Sign in.

    “Azure 登录”窗口,其中已选择“设备登录”

  4. 在“Azure 设备登录”对话框中单击“复制并打开”。 Click Copy&Open in Azure Device Login dialog .

    “Azure 登录”对话框窗口

  5. 在浏览器中粘贴设备代码(在最后一个步骤中单击“复制并打开”时已复制),然后单击“下一步”。 In the browser, paste your device code (which has been copied when you click Copy&Open in last step) and then click Next.

    设备登录浏览器

  6. 在“选择订阅”对话框中选择要使用的订阅,并单击“确定”。 In the Select Subscriptions dialog box, select the subscriptions that you want to use, and then click OK.

    “选择订阅”对话框

通过服务主体登录到 Azure 帐户Sign in to your Azure account by Service Principal

本部分逐步引导创建一个包含服务主体数据的凭据文件。This section walks you through creating a credentials file that contains your service principal data. 完成此过程后,在你打开项目时,IntelliJ 会使用凭据文件将你自动登录到 Azure。After you have completed this process, IntelliJ uses the credentials file to automatically sign you in to Azure when open your project.

  1. 使用 IntelliJ IDEA 打开项目。Open your project with IntelliJ IDEA.

  2. 打开边栏中的“Azure 资源管理器”,然后单击顶部栏中的“Azure 登录”图标(或者在 IDEA 菜单中选择“工具”>“Azure”>“Azure 登录”)。 Open sidebar Azure Explorer, and then click the Azure Sign In icon in the bar on top (or from IDEA menu Tools/Azure/Azure Sign in). “IntelliJ Azure 登录”命令The IntelliJ Azure Sign In command

  3. 在“Azure 登录”窗口中选择“服务主体”,然后单击“新建”。 In the Azure Sign In window, select Service Principal, and then click New.

    已选中“服务主体”的“Azure 登录”窗口

  4. 在“Azure 设备登录”对话框中单击“复制并打开”。 Click Copy&Open in Azure Device Login dialog .

    “Azure 登录”对话框窗口

  5. 在浏览器中粘贴设备代码(在最后一个步骤中单击“复制并打开”时已复制),然后单击“下一步”。 In the browser, paste your device code (which has been copied when you click Copy&Open in last step) and then click Next.

    设备登录浏览器

  6. 在“创建身份验证文件”窗口中选择要使用的订阅,选择目标目录,并单击“启动”。 In the Create Authentication Files window, select the subscriptions that you want to use, choose your destination directory, and then click Start.

    “创建身份验证文件”窗口

  7. 成功创建文件后,请在“服务主体创建状态”对话框中单击“确定”。 In the Service Principal Creation Status dialog box, click OK after your files have been created successfully.

    “服务主体创建状态”对话框

  8. 在“Azure 登录”窗口中单击“登录”。 In the Azure Sign In window, click Sign in.

    “Azure 登录”对话框

  9. 在“选择订阅”对话框中选择要使用的订阅,并单击“确定”。 In the Select Subscriptions dialog box, select the subscriptions that you want to use, and then click OK.

    “选择订阅”对话框

创建服务主体身份验证文件以后,即可从步骤 8 开始操作,选择身份验证文件并登录。Once you created the service principal authentication file, you could start from step 8, choose your authentication file and sign in.

注销 Azure 帐户Sign out of your Azure account

通过上述步骤配置帐户后,每次启动 IntelliJ IDEA 时都会自动登录。After you have configured your account by preceding steps, you will be automatically signed in each time you start IntelliJ IDEA. 但是,若要注销 Azure 帐户,请执行以下操作。However, if you want to sign out of your Azure account, do the following.

  • 在 IntelliJ IDEA 中打开“Azure 资源管理器”边栏,单击“Azure 注销”图标并进行确认(或者在 IDEA 菜单中选择“工具”>“Azure”>“Azure 注销”)。 In IntelliJ IDEA, open Azure Explorer side bar, click Azure Sign Out icon and confirm (or from IDEA menu Tools/Azure/Azure Sign Out).

    “IntelliJ Azure 注销”命令

后续步骤Next steps

若要报告 bug 或请求新功能,请在我们的 GitHub 存储库上创建问题。To report bugs or request new features, create issues on our GitHub repository. 或者,在 Stack Overflow 上使用标记 azure-java-tools 提出问题。Or, ask questions on Stack Overflow with tag azure-java-tools.

若要详细了解如何将 Java 与 Azure 配合使用,请参阅以下链接:For more information about using Java with Azure, see the following links: