小编Rus*_*dov的帖子

通过 User-Agent 标头标记 Azure 合作伙伴资源

在通过Resource Manager API创建资源时,我试图通过将合作伙伴产品 GUID 添加到 User-Agent 标头来实现Azure 资源合作伙伴标记,但它没有任何可见的效果。我检查了“标记”资源的 ARM 模板,但没有 GUID。文章中描述的验证方法也给出了否定的结果。

它对任何人都有效吗?

这是基于上面重现问题的指南的 Powershell 代码:

Install-Module -Name Az -AllowClobber -Scope CurrentUser # installs Azure Powerhsell module
$partnerID = "pid-3fd1a53d-3ef0-4111-8a66-211ed6470935" # Product GUID
$VMLocalAdminUser = "partneridtest" # test VM username
$VMLocalAdminSecurePassword = ConvertTo-SecureString "Pa$$word123" -AsPlainText -Force # test VM password
$resourceGroupName=[guid]::NewGuid().ToString() # randomly generated resource group name
Import-Module -Name Az # import Azure Powerhsell module
[Microsoft.Azure.Common.Authentication.AzureSession]::ClientFactory.AddUserAgent($partnerID) # add user-agent for partner tracking

Connect-AzAccount …
Run Code Online (Sandbox Code Playgroud)

azure azure-resource-manager azure-rest-api

8
推荐指数
1
解决办法
360
查看次数