管理员在 Power Platform 管理中心启用、禁用和编辑托管环境。 管理员还可以使用 PowerShell 禁用托管环境。 本文介绍管理环境和开始使用 Microsoft Power Platform 管理中心或 PowerShell 所需的权限。
权限
若要启用或编辑托管环境,需要在Microsoft Entra ID中使用 Power Platform 管理员或Dynamics 365管理员角色。 可以在 “使用服务管理员角色管理租户”中了解有关这些角色的详细信息。
- 任何有权查看环境详细信息的用户都可以查看某个环境的“托管环境”属性。
- 具有委派管理员角色或环境管理员安全角色的用户无法更改环境中的托管环境属性。
重要提示
- 在开始复制和还原环境生命周期操作之前,托管环境属性在源和目标中必须相同。
- 需要 Dataverse 才能将托管环境用于生产、沙盒或试用环境类型。 开发环境无需 Dataverse 即可启用托管环境。
在管理中心启用或编辑托管环境
登录到 Power Platform 管理中心。
在导航窗格中,选择“ 管理”,然后在“ 管理 ”窗格中,选择“ 环境”。
选择环境旁边的省略号,然后在菜单中选择“ 启用托管环境”。 如果环境已被托管,选择编辑托管环境。
配置设置,然后选择启用或保存。
使用 PowerShell 启用托管环境
管理员还可以使用 PowerShell 启用托管环境。 以下 PowerShell 脚本为单个环境启用它。
$GovernanceConfiguration = [pscustomobject] @{
protectionLevel = "Standard"
settings = [pscustomobject]@{
extendedSettings = @{}
}
}
Set-AdminPowerAppEnvironmentGovernanceConfiguration -EnvironmentName <EnvironmentID> -UpdatedGovernanceConfiguration $GovernanceConfiguration
使用 PowerShell 复制托管环境设置
管理员可以使用 PowerShell 将设置从一个托管环境复制到另一个环境。 如果目标环境不是托管环境,复制设置也会将其作为托管环境启用。
#Get settings from the source managed environment
$sourceEnvironment = Get-AdminPowerAppEnvironment -EnvironmentName <SourceEnvironmentId>
# Copy the settings from the source managed environment above to the target environment
Set-AdminPowerAppEnvironmentGovernanceConfiguration -EnvironmentName <TargetEnvironmentId> -UpdatedGovernanceConfiguration $sourceEnvironment.Internal.properties.governanceConfiguration
使用 PowerShell 禁用托管环境
管理员可以使用 PowerShell 从环境中删除托管环境属性。 在禁用托管环境之前,请确保未使用任何托管环境功能。
下面是调用 API 以设置托管环境属性的示例 PowerShell 脚本:
$UpdatedGovernanceConfiguration = [pscustomobject]@{
protectionLevel = "Basic"
}
Set-AdminPowerAppEnvironmentGovernanceConfiguration -EnvironmentName <EnvironmentID> -UpdatedGovernanceConfiguration $UpdatedGovernanceConfiguration