1

Is there a method of creating Azure API Management Tags in Powershell? I have used the Set-AzApiManagementProperty to created Named Values but there does not appear to be an equivilent in AzAPIManagement for the creation of tags.

Any one done this previously?

enter image description here

2 Answers 2

1

You could use New-AzResource to create the tag, try the script below, it creates a tag named 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

enter image description here

enter image description here

7
  • Hi Joy, I get an error when running that statement, 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 Commented Dec 11, 2019 at 8:07
  • @PhilMurray Try to update the powershell version via Update-Module -Name Az -Force.
    – Joy Wang
    Commented Dec 11, 2019 at 8:15
  • Just updated the Az libraries and rerun the command a I get the same error Commented Dec 11, 2019 at 8:28
  • @PhilMurray Could you make sure your script is exactly the same as mine? Could you provide your complete script in your question?
    – Joy Wang
    Commented Dec 11, 2019 at 8:31
  • @PhilMurray Just copy and paste, change the tag1, <resource-group-name>, <API-Management-service-name>, could it work?
    – Joy Wang
    Commented Dec 11, 2019 at 8:45
0

Please have a look here:

How to Add Tags to api of APIM via powershell script

1
  • Hi Markus, I have seen that previously. It seems to be for adding existing Tags to a new API. Might be missing something though Commented Dec 10, 2019 at 18:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.