微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何在 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}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。