【问题标题】:Creating Azure API Management tags in Powershell在 Powershell 中创建 Azure API 管理标签
【发布时间】:2019-12-10 14:57:40
【问题描述】:

是否有在 Powershell 中创建 Azure API 管理标签的方法?我已经使用 Set-AzApiManagementProperty 创建了命名值,但在 AzAPIManagement 中似乎没有用于创建标签的等效项。

以前有人做过吗?

【问题讨论】:

    标签: azure powershell tags azure-api-management


    【解决方案1】:

    你可以使用New-AzResource来创建标签,试试下面的脚本,它会创建一个名为tag1的标签。

    $ResourceName = "tag1"
    $PropertiesObject = @{
        displayName = "tag1"
    }
    New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName <resource-group-name> -ResourceType Microsoft.ApiManagement/service/tags -ResourceName "<API-Management-service-name>/$ResourceName" -ApiVersion 2018-01-01 -Force
    

    【讨论】:

    • 嗨,Joy,运行该语句时出现错误,New-AzResource : {"Message":"The requested resource does not support http method 'PUT'."} At line:3 char: 1 + New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName $ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzResource], ErrorResponseMessageException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
    • @PhilMurray 尝试通过Update-Module -Name Az -Force更新powershell版本。
    • 刚刚更新了 Az 库并重新运行命令我得到了同样的错误
    • @PhilMurray 你能确定你的剧本和我的一模一样吗?您能否在问题中提供完整的脚本?
    • @PhilMurray 复制粘贴,改一下tag1,&lt;resource-group-name&gt;,&lt;API-Management-service-name&gt;,可以吗?
    【解决方案2】:

    【讨论】:

    • 嗨,Markus,我以前见过。似乎是为了将现有标签添加到新 API。可能会遗漏一些东西
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-29
    • 1970-01-01
    • 1970-01-01
    • 2020-05-02
    相关资源
    最近更新 更多