Update-AzTag
Selectively updates the set of tags on a resource or subscription.
Синтаксис
Default (по умолчанию)
Update-AzTag
[-ResourceId] <String>
[-Tag] <Hashtable>
[-Operation] <TagPatchOperation>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Описание
The Update-AzTag cmdlet with a ResourceId selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs.
Примеры
Example 1: Selectively updates the set of tags on a subscription with "Merge" Operation
$mergedTags = @{"key1"="value1"; "key3"="value3";}
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $mergedTags -Operation Merge
Id : {Id}
Name : {Name}
Type : {Type}
Properties :
Name Value
======= =========
key1 value1
key2 value2
key3 value3
This command Merges the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
Example 2: Selectively updates the set of tags on a subscription with "Replace" Operation
$replacedTags = @{"key1"="value1"; "key3"="value3";}
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $replacedTags -Operation Replace
Id : {Id}
Name : {Name}
Type : {Type}
Properties :
Name Value
======= =========
key1 value1
key3 value3
This command Replaces the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
Example 3: Selectively updates the set of tags on a subscription with "Delete" Operation
$deletedTags = @{"key1"="value1"}
Update-AzTag -ResourceId /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -Tag $deletedTags -Operation Delete
Id : {Id}
Name : {Name}
Type : {Type}
Properties :
Name Value
======= =========
key3 value3
This command Deletes the set of tags on the subscription with "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".
Параметры
-Confirm
Prompts you for confirmation before running the cmdlet.
Свойства параметра
Тип: | SwitchParameter |
Default value: | False |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Aliases: | cf |
Наборы параметров
(All)
Position: | Named |
Обязательно: | False |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | False |
Значение из оставшихся аргументов: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Свойства параметра
Тип: | IAzureContextContainer |
Default value: | None |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Наборы параметров
(All)
Position: | Named |
Обязательно: | False |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | False |
Значение из оставшихся аргументов: | False |
-Operation
The update operation. Options are Merge, Replace and Delete.
Свойства параметра
Тип: | TagPatchOperation |
Default value: | None |
Допустимые значения: | Merge, Replace, Delete |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Наборы параметров
(All)
Position: | 2 |
Обязательно: | True |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | True |
Значение из оставшихся аргументов: | False |
-ResourceId
The resource identifier for the tagged entity. A resource, a resource group or a subscription may be tagged.
Свойства параметра
Тип: | String |
Default value: | None |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Наборы параметров
(All)
Position: | 0 |
Обязательно: | True |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | True |
Значение из оставшихся аргументов: | False |
-Tag
The set of tags to use for update.
Свойства параметра
Тип: | Hashtable |
Default value: | None |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Наборы параметров
(All)
Position: | 1 |
Обязательно: | True |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | True |
Значение из оставшихся аргументов: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Свойства параметра
Тип: | SwitchParameter |
Default value: | False |
Поддерживаются подстановочные знаки: | False |
DontShow: | False |
Aliases: | wi |
Наборы параметров
(All)
Position: | Named |
Обязательно: | False |
Значение из конвейера: | False |
Значение из конвейера по имени свойства: | False |
Значение из оставшихся аргументов: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.