如何在Azure PowerShell中将API管理中的订阅从一个用户转移到另一个用户



我想将API管理订阅的控制权从一个用户转移到另一个用户,以防原始用户离开公司或更改工作角色。

准备好源和目标用户的电子邮件地址,调整并使用这些Azure PowerShell命令:

$ctx = New-AzApiManagementContext -ResourceGroupName {your-resource-group} -ServiceName {your-APIM-service-name}
$from = Get-AzApiManagementUser -Context $ctx -Email "from.user@my-company.com"
$to = Get-AzApiManagementUser -Context $ctx -Email "to.user@my-company.com"
Get-AzApiManagementSubscription -Context $ctx -UserId $from.UserId | ConvertTo-Json | Set-Content ./SubscriptionDump.json
Get-Content .SubscriptionDump.json | ConvertFrom-Json | %{Set-AzApiManagementSubscription -Context $ctx -SubscriptionId $_.SubscriptionId -UserId $to.UserId}

相关内容

最新更新