QUESTION IMAGE
Question
what does the following script achieve?
$tags = @{\dept\=\sales\; \status\=\upside\}
$resource = get-azresource -name globalstorage -resourcegroup globalgroup
new-aztag -resourceid $resource.id -tag $tags
a assign the tags \sales\ and \upside\ to an azure subscription.
b assign the tags \sales\ and \upside\ to a storage account.
c assign the tags \sales\ and \upside\ to a resource group.
d assign the tags \sales\ and \upside\ to a resource management group.
Brief Explanations
- Analyze the
Get - AzResourcecmdlet: TheGet - AzResourceis used with-Name GlobalStorageand-ResourceGroup GlobalGroup. This indicates that the resource being retrieved is a storage account (since the name suggests storage and it's in a resource group). - Analyze the
New - AzTagcmdlet: TheNew - AzTagcmdlet is used with the resource ID of the retrieved resource (which is a storage account) and the tags@{"Dept"="Sales"; "Status"="Upside"}. - Evaluate the options:
- Option A: The script is not assigning tags to an Azure subscription. The
Get - AzResourceis for a specific resource (storage account), not a subscription. - Option B: Since the resource retrieved is a storage account (from
Get - AzResource -Name GlobalStorage), and tags are being assigned to this resource, this option is correct. - Option C: The resource is a storage account, not a resource group. The
Get - AzResourceis targeting a resource (GlobalStorage) in a resource group (GlobalGroup), not the resource group itself. - Option D: The script is not related to a resource management group. It's about a specific storage account resource.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
B. Assign the tags "Sales" and "Upside" to a storage account.