本文演示如何管理 Azure 订阅中的预览功能。 借助预览功能,你可以在发布前便选择使用新功能。 有意向选择加入的任何用户都可以使用部分预览功能。 其他预览功能则需要获得产品团队的批准。
可通过 Microsoft.Features 命名空间获取 Azure 功能公开控件 (AFEC)。 预览功能的资源 ID 格式如下:
Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}
若要在 Azure 订阅中列出、注册或取消注册预览功能,需要对 Microsoft.Features/*
操作的访问权限。 此权限是通过参与者和所有者内置角色授予的。 还可以通过自定义角色指定所需的访问权限。
可以列出 Azure 订阅的所有预览功能及其注册状态。
若要列出订阅的所有预览功能,请使用 Get-AzProviderFeature 命令。
Get-AzProviderFeature -ListAvailable
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
betaAccess Microsoft.AAD NotRegistered
previewAccess Microsoft.AAD Registered
tipAccess Microsoft.AAD Pending
testAccess Microsoft.AAD Unregistered
若要筛选特定资源提供程序的输出,请使用 ProviderNamespace
参数。 默认输出仅会显示已注册的功能。 若要显示资源提供程序的所有预览功能,请配合使用 ListAvailable
参数与 ProviderNamespace
参数。
Get-AzProviderFeature -ProviderNamespace "Microsoft.Compute" -ListAvailable
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
AHUB Microsoft.Compute Unregistered
AllowManagedDisksReplaceOSDisk Microsoft.Compute Registered
AllowPreReleaseRegions Microsoft.Compute Pending
InGuestPatchVMPreview Microsoft.Compute NotRegistered
可以使用 FeatureName
参数筛选特定预览功能的输出。
Get-AzProviderFeature -FeatureName "InGuestPatchVMPreview" -ProviderNamespace "Microsoft.Compute"
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute NotRegistered
在 Azure 订阅中注册预览功能,以公开资源提供程序的更多功能。 部分预览功能需要审批。
在订阅中注册预览功能后,你将看到以下两种状态之一:已注册或待处理 。
- 对于无需审批的预览功能,状态则为“已注册”。
- 如果预览功能需要审批,则注册状态为“待处理”。 必须从提供预览功能的 Azure 服务请求批准。 通常,可以通过支持工单请求访问权限。
- 若要请求审批,请提交 Azure 支持请求。
- 注册获得批准后,预览功能的状态将更改为“已注册”。
某些服务需要其他方法(如电子邮件)才能获得挂起请求的批准。 查看有关预览功能的公告,了解有关如何获取访问权限的信息。
若要注册预览功能,请使用 Register-AzProviderFeature cmdlet。
Register-AzProviderFeature -FeatureName "InGuestPatchVMPreview" -ProviderNamespace "Microsoft.Compute"
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute Registering
若要查看注册状态,请使用 Get-AzProviderFeature
cmdlet。
Get-AzProviderFeature -FeatureName "InGuestPatchVMPreview" -ProviderNamespace "Microsoft.Compute"
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute Registered
使用完预览功能后,请从 Azure 订阅中注销该功能。 注销预览功能后,你可能会注意到两种不同的状态。 如果通过门户注销,状态将设为“未注册”。 如果通过 Azure CLI、PowerShell 或 REST API 注销,则状态将设为“已注销”。 状态存在差异的原因在于,门户会删除功能注册,但命令则会取消注册该功能。 在这两种情况下,该功能在订阅中均不再可用, 但可以通过重新注册功能来再次选择使用该功能。
若要注销预览功能,请使用 Unregister-AzProviderFeature cmdlet。 RegistrationState
状态将更改为“已注销”。
Unregister-AzProviderFeature -FeatureName "InGuestPatchVMPreview" -ProviderNamespace "Microsoft.Compute"
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute Unregistering
若要查看注销状态,请使用 Get-AzProviderFeature
cmdlet。
Get-AzProviderFeature -FeatureName "InGuestPatchVMPreview" -ProviderNamespace "Microsoft.Compute"
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute Unregistered
以下示例显示 Microsoft.Compute
资源提供程序的“已注销”预览功能。
Get-AzProviderFeature -ProviderNamespace "Microsoft.Compute" -ListAvailable | Where-Object { $_.RegistrationState -eq "Unregistered" }
FeatureName ProviderName RegistrationState
----------- ------------ -----------------
InGuestPatchVMPreview Microsoft.Compute Unregistered
如果尚未使用内置策略定义注册,则可以修正订阅以注册到预览功能。 请注意,不会自动注册添加到现有租户的新订阅。
- 若要使用 REST API 调用并列出、注册或注销预览功能,请参阅功能文档。
- 有关如何注册资源提供程序的详细信息,请参阅 Azure 资源提供程序和类型。
- 有关将资源提供程序映射到 Azure 服务的列表,请参阅 Azure 服务的资源提供程序。