Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tagging for resource groups #8166

Closed
markcowl opened this issue Dec 18, 2018 · 3 comments
Closed

Fix tagging for resource groups #8166

markcowl opened this issue Dec 18, 2018 · 3 comments
Assignees
Milestone

Comments

@markcowl
Copy link
Member

Description

Currently, tagging resource groups is only available through Set-AzResourceGroup, which will remove any additional properties applied to the resource group (e.g ManagedBy)

@markcowl markcowl added this to the 2019-01-15 milestone Dec 18, 2018
@lwajswaj
Copy link
Contributor

Do you mean it will remove addition tags in the resource group?

@maddieclayton
Copy link
Contributor

@markcowl Can you flesh out this issue a little further?

@markcowl
Copy link
Member Author

markcowl commented Jan 18, 2019

No, there are properties that can exist in the resource group itself (as a resource) that are optional (and rare). For example, for 'ManagedBy' is a property that exists if a resource group is created by a service as a by-product of some other task (for example, some resources create a resource group in the region to place shared resources on behalf of the user.

The issue is that, the serialization model for ResourceGroup does not contain any of these additional properties, so if a PUT is performed, it will remove any values from these properties, because the proeprty is not specified in the payload of the put.

For example, a resource like:

{
   "properties": {
     "name": "foo",
     "id": "/subscriptions/xxxx-xxxx-xxxx-yyyy/ResourceGroups/foo",
     "tags": ["foo", "bar"],
     "managedBy": "Microsoft.Widgets"
   }
}

will appear in the PUT payload as:

{
   "properties": {
     "name": "foo",
     "id": "/subscriptions/xxxx-xxxx-xxxx-yyyy/ResourceGroups/foo",
     "tags":  ["foo", "bar"]
   }
}

So that the additional property 'ManagedBy' is removed.

This can be resolved in a couple of ways:
(1) Since this cmdlet can really only be used for tags, perform a PATCH instead of a PUT, this will automatically make the operation resilient over changes in the model
(2) Update the mode for the PUT to include the known optional properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants