在 Azure 门户中创建并管理 Azure 机器学习工作区Create and manage Azure Machine Learning workspaces in the Azure portal

本文将介绍如何在 Azure 门户中针对 ](concept-workspace.md)。In this article, you'll create, view, and delete Azure Machine Learning workspaces in the Azure portal for Azure Machine Learning. 门户是开始使用工作区的最简单方法,但随着需求的变化或自动化要求的增加,还可以使用 CLI使用 Python 代码使用 VS Code 扩展创建和删除工作区。The portal is the easiest way to get started with workspaces but as your needs change or requirements for automation increase you can also create and delete workspaces using the CLI, with Python code or via the VS Code extension.

创建工作区Create a workspace

必须有 Azure 订阅,才能创建工作区。To create a workspace, you need an Azure subscription. 如果没有 Azure 订阅,请在开始前创建一个试用帐户。If you don't have an Azure subscription, create a trial account before you begin. 立即试用试用版 Azure 机器学习Try the trial version of Azure Machine Learning today.

  1. 使用 Azure 订阅的凭据登录到 Azure 门户Sign in to the Azure portal by using the credentials for your Azure subscription.

  2. 在 Azure 门户的左上角,选择“+ 创建资源” 。In the upper-left corner of Azure portal, select + Create a resource .


  3. 使用搜索栏查找“机器学习” 。Use the search bar to find Machine Learning .

  4. 选择“机器学习” 。Select Machine Learning .

  5. 在“机器学习”窗格中,选择“创建”以开始 。In the Machine Learning pane, select Create to begin.

  6. 提供以下信息来配置新工作区:Provide the following information to configure your new workspace:

    字段Field 说明Description
    工作区名称Workspace name 输入用于标识工作区的唯一名称。Enter a unique name that identifies your workspace. 本示例使用 docs-ws 。In this example, we use docs-ws . 名称在整个资源组中必须唯一。Names must be unique across the resource group. 使用易于记忆且区别于其他人所创建工作区的名称。Use a name that's easy to recall and to differentiate from workspaces created by others. 工作区名称不区分大小写。The workspace name is case-insensitive.
    订阅Subscription 选择要使用的 Azure 订阅。Select the Azure subscription that you want to use.
    资源组Resource group 使用订阅中的现有资源组,或者输入一个名称以创建新的资源组。Use an existing resource group in your subscription or enter a name to create a new resource group. 资源组保存 Azure 解决方案的相关资源。A resource group holds related resources for an Azure solution. 本示例使用 docs-aml 。In this example, we use docs-aml . 需要“参与者”或“所有者”角色才能使用现有资源组。You need contributor or owner role to use an existing resource group. 有关访问权限的详细信息,请参阅管理对 Azure 机器学习工作区的访问权限For more information about access, see Manage access to an Azure Machine Learning workspace.
    区域Region 选择离你的用户和数据资源最近的 Azure 区域来创建工作区。Select the Azure region closest to your users and the data resources to create your workspace.
    工作区版本Workspace edition 选择“基本” 或“企业” 。Select Basic or Enterprise . 此工作区版本决定了可访问的功能和定价。This workspace edition determines the features to which you'll have access and pricing. 详细了解 Azure 机器学习Learn more about Azure Machine Learning.


  7. 完成工作区配置后,选择“查看 + 创建” 。When you're finished configuring the workspace, select Review + Create . (可选)使用网络高级部分为工作区配置更多设置。Optionally, use the Networking and Advanced sections to configure more settings for the workspace.

  8. 查看设置并进行任何其他更改或更正。Review the settings and make any additional changes or corrections. 如果对设置感到满意,请选择“创建” 。When you're satisfied with the settings, select Create .


    在云中创建工作区可能需要几分钟时间。It can take several minutes to create your workspace in the cloud.

    完成创建后,会显示部署成功消息。When the process is finished, a deployment success message appears.

  9. 若要查看新工作区,请选择“转到资源” 。To view the new workspace, select Go to resource .

下载配置文件Download a configuration file

  1. 如果要创建计算实例,请跳过此步骤。If you will be creating a compute instance, skip this step.

  2. 如果计划使用引用此工作区的本地环境中的代码,请 从工作区的“概述” 部分中选择“下载 config.json”。If you plan to use code on your local environment that references this workspace, select Download config.json from the Overview section of the workspace.

    下载 config.json

    使用 Python 脚本或 Jupyter Notebook 将此文件放入到目录结构中。Place the file into the directory structure with your Python scripts or Jupyter Notebooks. 它可以位于同一目录(名为 .azureml 的子目录)中,也可以位于父目录中。It can be in the same directory, a subdirectory named .azureml , or in a parent directory. 创建计算实例时,此文件会添加到 VM 上的正确目录中。When you create a compute instance, this file is added to the correct directory on the VM for you.

查找工作区Find a workspace

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 在顶部搜索字段中,键入“机器学习”。 In the top search field, type Machine Learning .

  3. 选择“机器学习” 。Select Machine Learning .

    搜索 Azure 机器学习工作区

  4. 浏览筛选出的工作区列表。Look through the list of workspaces found. 筛选依据可包括订阅、资源组和位置。You can filter based on subscription, resource groups, and locations.

  5. 选择工作区即可显示其属性。Select a workspace to display its properties.

创建工作区Delete a workspace

在 。In the Azure portal, select Delete at the top of the workspace you wish to delete.


清理资源Clean up resources


已创建的资源可以用作其他 Azure 机器学习教程和操作方法文章的先决条件。The resources you created can be used as prerequisites to other Azure Machine Learning tutorials and how-to articles.

如果不打算使用已创建的资源,请删除它们,以免产生任何费用:If you don't plan to use the resources you created, delete them, so you don't incur any charges:

  1. 在 Azure 门户中,选择最左侧的“资源组” 。In the Azure portal, select Resource groups on the far left.

    在 Azure 门户中删除Delete in the Azure portal

  2. 从列表中选择已创建的资源组。From the list, select the resource group you created.

  3. 选择“删除资源组” 。Select Delete resource group.

  4. 输入资源组名称。Enter the resource group name. 然后选择“删除” 。Then select Delete.


资源提供程序错误Resource provider errors

创建 Azure 机器学习工作区或工作区使用的资源时,可能会收到类似于以下消息的错误:When creating an Azure Machine Learning workspace, or a resource used by the workspace, you may receive an error similar to the following messages:

  • No registered resource provider found for location {location}
  • The subscription is not registered to use namespace {resource-provider-namespace}

大多数资源提供程序均已自动注册,但并非全部。Most resource providers are automatically registered, but not all. 如果收到此消息,则需要注册提到的提供程序。If you receive this message, you need to register the provider mentioned.

有关注册资源提供程序的信息,请参阅解决资源提供程序注册的错误For information on registering resource providers, see Resolve errors for resource provider registration.

移动工作区Moving the workspace


不支持将 Azure 机器学习工作区移动到另一个订阅,或将拥有的订阅移到新租户。Moving your Azure Machine Learning workspace to a different subscription, or moving the owning subscription to a new tenant, is not supported. 这样做可能会导致错误。Doing so may cause errors.

删除 Azure 容器注册表Deleting the Azure Container Registry

Azure 机器学习工作区使用 Azure 容器注册表 (ACR) 执行某些操作。The Azure Machine Learning workspace uses Azure Container Registry (ACR) for some operations. 首次需要 ACR 实例时,它会自动创建一个。It will automatically create an ACR instance when it first needs one.


为工作区创建 Azure 容器注册表后,请不要将其删除。Once an Azure Container Registry has been created for a workspace, do not delete it. 删除该注册表将损坏 Azure 机器学习工作区。Doing so will break your Azure Machine Learning workspace.

后续步骤Next steps

学习整个教程,了解如何通过 Azure 机器学习使用工作区来生成、定型和部署模型。Follow the full-length tutorial to learn how to use a workspace to build, train, and deploy models with Azure Machine Learning.