启用托管环境

管理员在 Power Platform 管理中心启用、禁用和编辑托管环境。 管理员还可以使用 PowerShell 禁用托管环境。 本文介绍管理环境和开始使用 Microsoft Power Platform 管理中心或 PowerShell 所需的权限。

权限

若要启用或编辑托管环境,需要在 Microsoft Entra ID 中使用 Power Platform Administrator 或 Dynamics 365 管理员角色。 可以在 “使用服务管理员角色管理租户”中了解有关这些角色的详细信息。

  • 有权查看环境详细信息的任何用户都可以查看环境的托管环境属性。
  • 具有委派管理员角色或环境管理员安全角色的用户无法更改环境中的托管环境属性。

重要提示

  • 托管环境属性在源和目标中必须相同,然后您才能开始执行环境生命周期操作的复制和还原。
  • 要在某种环境类型中使用托管环境,必须使用 Dataverse。

在管理中心启用或编辑托管环境

  1. 登录到 Power Platform 管理中心

  2. 在导航窗格中,选择“ 管理”,然后在“ 管理 ”窗格中,选择“ 环境”。

  3. 选择环境旁边的省略号,然后在菜单中选择“ 启用托管环境”。 如果环境已被托管,选择编辑托管环境

  4. 配置设置,然后选择启用保存

使用 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