您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

在 Azure 开发测试实验室中使用平台即服务 (PaaS) 服务Use Platform-as-a-Service (PaaS) services in Azure DevTest Labs

PaaS 通过环境功能在开发测试实验室中受支持。PaaS is supported in DevTest Labs via the environments feature. 开发测试实验室中的环境通过 Git 存储库中的预配置 Azure 资源管理器模板来支持。Environments in DevTest Labs are supported by pre-configured Azure Resource Manager templates in a Git repository. 环境可以同时包含 PaaS 和 IaaS 资源。Environments can contain both PaaS and IaaS resources. 它们允许你创建可包含 Azure 资源(例如虚拟机、数据库、虚拟网络和 Web 应用)的复杂系统,这些资源可自定义以协同工作。They allow you to create complex systems that can include Azure resources such as virtual machines, databases, virtual networks, and Web apps, which are customized to work together. 这些模板允许使用源代码管理一致地部署和改善环境。These templates allow consistent deployment and improved management of environments using source code control.

正确设置的系统允许以下方案:A properly set up system allows the following scenarios:

  • 具有独立环境和多个环境的开发人员Developers to have independent and multiple environments
  • 以异步方式测试不同的配置Testing on different configurations asynchronously
  • 集成到过渡和生产管道,无需任何模板更改Integration into staging and production pipelines without any template changes
  • 在同一实验室中同时拥有开发计算机和环境可以提高管理和成本报告的简易性。Having both development machines and environments within the same lab improves ease of management and cost reporting.

开发测试实验室资源提供程序代表实验室用户创建资源,因此,无需向实验室用户提供额外的权限即可使用 PaaS 资源。The DevTest Labs resource provider creates resources on the lab user’s behalf, so no extra permissions need to be given to the lab user to enable use of the PaaS resources. 下图显示了作为实验室环境的 Service Fabric 群集。The following image shows a Service Fabric cluster as an environment in the lab.

将群集作为环境 Service Fabric

有关设置环境的详细信息,请参阅 通过 Azure 资源管理器模板创建多 VM 环境和 PaaS 资源For for more information on setting up environments, see Create multi-VM environments and PaaS resources with Azure Resource Manager templates. 开发测试实验室提供 Azure 资源管理器模板的公共存储库,你可以使用这些模板来创建环境,而无需自行连接到外部 GitHub 源。DevTest Labs has a public repository of Azure Resource Manager templates that you can use to create environments without having to connect to an external GitHub source by yourself. 有关公共环境的详细信息,请参阅 在 Azure 开发测试实验室中配置和使用公共环境For more information on public environments, see Configure and use public environments in Azure DevTest Labs.

在大型组织中,开发团队通常会提供一些环境,如自定义/隔离测试环境。In large organizations, development teams typically provide environments such as customized/isolated testing environments. 业务部门或部门内的所有团队可能会使用环境。There may be environments that are to be used by all teams within a business unit or a division. IT 小组可能需要提供组织中的所有团队均可使用的环境。The IT group may want to provide their environments that can be used by all the teams in the organization.

自定义Customizations

沙盒Sandbox

实验室所有者可以自定义实验室环境,以便将用户的角色从 读取 者更改为资源组中的 参与者The lab owner can customize lab environments to change the user’s role from reader to contributor within the resource group. 此功能位于实验室的 "配置和策略" 下的 "实验室设置" 页中。This capability is in the Lab Settings page under the Configuration and Policies of the lab. 此角色更改允许用户在该环境中添加或删除资源。This change in role allows the user to add or remove resources within that environment. 如果希望进一步限制访问权限,请使用 Azure 策略。If you want to restrict the access further, use Azure policies. 此功能可让你在订阅级别无需访问权限的情况下自定义资源或配置。This functionality allows you to customize the resources or configuration without the access at the subscription level.

自定义令牌Custom tokens

资源组外部有一些自定义实验室信息,该信息特定于模板可以访问的环境。There's some custom lab information that is outside of the resource group and is specific to environments that the template can access. 以下介绍了部分功能:Here are some of them:

  • 实验室网络标识Lab network identification
  • 位置Location
  • 存储资源管理器模板文件的存储帐户。Storage account in which the Resource Manager templates files are stored.

实验室虚拟网络Lab virtual network

环境连接到实验室的虚拟网络 一文介绍了如何修改资源管理器模板以使用该 $(LabSubnetId) 令牌。The Connecting environments to the lab's virtual network article describes how to modify your Resource Manager template to use the $(LabSubnetId) token. 创建环境时,会将 $(LabSubnetId) 令牌替换为第一个子网标记,其中 " 在虚拟机中使用 " 选项设置为 trueWhen an environment is created, the $(LabSubnetId) token is replaced by the first subnet mark where the use in virtual machine creation option is set to true. 它使我们的环境可以使用以前创建的网络。It allows our environment to use previously created networks. 如果要在作为过渡和生产的测试环境中使用相同资源管理器模板,请 $(LabSubnetId) 在资源管理器模板参数中使用作为默认值。If you want to use the same Resource Manager templates in environments in test as staging and production, use $(LabSubnetId) as a default value in a Resource Manager template parameter.

环境存储帐户Environment Storage Account

开发测试实验室支持使用 嵌套资源管理器模板DevTest Labs supports the use of nested Resource Manager templates. [部署用于测试环境的嵌套 Azure 资源管理器模板 一文介绍了如何使用 _artifactsLocation 和标记在 _artifactsLocationSasToken 主模板的相同文件夹中创建资源管理器模板的 URI。The [Deploy nested Azure Resource Manager templates for testing environments article explains how to use _artifactsLocation and _artifactsLocationSasToken tokens to create a URI to a Resource Manager template in the same folder as or in a nested folder of the main template. 有关这两个令牌的详细信息,请参阅 Azure 资源管理器的 部署项目 部分 -最佳实践指南For more information about these two tokens, see the Deployment artifacts section of Azure Resource Manager – Best Practices Guide.

用户体验User Experience

开发人员Developer

开发人员使用相同的工作流创建 VM 来创建特定环境。Developers use the same workflow for creating a VM to create a specific environment. 它们选择环境与计算机映像,并输入模板所需的必要信息。They select the environment vs. the machine image and enter the necessary information required by the template. 拥有环境的每个开发人员都可以部署更改和改进的内部循环调试。Each developer having an environment allows for deployment of changes and improved inner loop debugging. 使用最新模板随时可以创建环境。The environment can be created at any time using the latest template. 利用此功能,可以销毁并重新创建环境,以帮助减少因手动创建系统或从错误测试中恢复而导致的停机时间。This feature allows the environments to be destroyed and recreated to help reduce the downtime from having to manually creating the system or recovering from fault testing.

测试Testing

开发测试实验室环境允许以异步方式独立测试特定的代码和配置。DevTest Labs environments allow for independent testing of specific code and configurations asynchronously. 常见的做法是在环境中设置来自单个拉取请求的代码,并启动任何自动测试。The common practice is to set up the environment with the code from the individual pull request and start any automated testing. 自动测试完成运行后,可以针对特定环境执行任何手动测试。Once the automated testing has run to completion, any manual testing can be executed against the specific environment. 此过程通常作为 CI/CD 管道的一部分完成。Usually this process is done as part of the CI/CD pipeline.

管理体验Management Experience

成本跟踪Cost Tracking

成本跟踪功能包含不同环境中的 Azure 资源,作为总体成本趋势的一部分。The cost tracking feature includes Azure resources within the different environments as part of the overall cost trend. 成本按资源不会分解环境中的不同资源,而是将环境显示为单个成本。The cost by resources doesn't break out the different resources within the environment but displays the environment as a single cost.

安全性Security

使用开发测试实验室正确配置的 Azure 订阅可以 仅通过实验室限制对 azure 资源的访问A properly configured Azure subscription with DevTest Labs can limit access to Azure resources only through the lab. 利用环境,实验室所有者可允许用户使用批准的配置访问 PaaS 资源,而无需访问任何其他 Azure 资源。With environments, a lab owner can allow users to access PaaS resources with approved configurations without allowing access to any other Azure resources. 在实验室用户自定义环境的方案中,实验室所有者可以允许参与者访问。In the scenario where lab users customize environments, the lab owner can allow contributor access. 参与者访问权限允许实验室用户仅在托管资源组中添加或删除 Azure 资源。The contributor access allows the lab user to add or remove Azure resource only within the managed resource group. 它允许更轻松地进行跟踪和管理,而不允许用户参与者访问订阅。It allows for easier tracking and management versus allow the user contributor access to the subscription.

自动化Automation

自动化是大规模、有效生态系统的关键组件。Automation is a key component for a large scale, effective ecosystem. 自动化是处理跨订阅和实验室管理或跟踪多个环境所必需的。Automation is necessary to handle managing or tracking multiple environments across subscriptions and labs.

CI/CD 管道CI/CD Pipeline

开发测试实验室中的 PaaS 服务可以通过在实验室控制访问权限的集中部署来帮助改善 CI/CD 管道。PaaS services in DevTest Labs can help improve the CI/CD pipeline by having focused deployments where access is controlled by the lab.

后续步骤Next steps

有关环境的详细信息,请参阅以下文章:See the following articles for details about environments:

-