exam questions

Exam AZ-400 All Questions

View all questions & answers for the AZ-400 exam

Exam AZ-400 topic 4 question 33 discussion

Actual exam question from Microsoft's AZ-400
Question #: 33
Topic #: 4
[All AZ-400 Questions]

HOTSPOT -
Your company has an Azure subscription.
The company requires that all resource groups in the subscription have a tag named organization set to a value of Contoso.
You need to implement a policy to meet the tagging requirement.
How should you complete the policy? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: " Microsoft.Resources/subscriptions/resourceGroups"
Box 2: "Deny",
Sample - Enforce tag and its value on resource groups
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
},
{
"not": {
"field": "[concat('tags[',parameters('tagName'), ']')]",
"equals": "[parameters('tagValue')]"
}
}
]
},
"then": {
"effect": "deny"
}
}
}
}
Reference:
https://docs.microsoft.com/en-us/azure/governance/policy/samples/enforce-tag-on-resource-groups

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
TosO
Highly Voted 5 years, 2 months ago
"The company requires that all resource groups in the subscription have a tag named organization set to a value of Contoso." - This means also the existing resource groups need to have a tag. For that reason: 1. Microsoft.Resources/subscriptions/resourceGroups 2. Append There is a pre-built policy in Azure for this, called: Append a tag and its value to resource groups
upvoted 134 times
MP270915
5 years, 2 months ago
Yes, it is Append, also because i wouldn't have that "details" propery below. That is used for Append, not for Deny. https://docs.microsoft.com/en-us/azure/governance/policy/concepts/effects#append
upvoted 3 times
[Removed]
5 years, 2 months ago
No it is deny...because it is showing if Not contoso then deny the deployment....There is a not condition....if it was assignment then it would have been append
upvoted 8 times
hubeau
5 years, 2 months ago
If this resource groups hasn't a organization tag, we should append this tag onto this resource groups. So it should be append
upvoted 2 times
luango
5 years ago
But append is intended for use with non-tag properties. So i think deny is the correct answer in this case.
upvoted 2 times
yemma
5 years ago
Deny doesn't have any property, so the answer is Append and as Tos0 explained we have to correct the existing RG by appending the tag: https://docs.microsoft.com/fr-fr/azure/governance/policy/concepts/effects#deny
upvoted 2 times
...
...
...
...
...
Morettimaxi
4 years, 11 months ago
Appends the specified tag with its value from the resource group when any resource which is missing this tag is created or updated. Does not modify the tags of resources created before this policy was applied until those resources are changed. New 'modify' effect policies are available that support remediation of tags on existing resources (see https://aka.ms/modifydoc Append Does not modify the tags of resources created before this policy was applied until those resources are changed. New 'modify' effect policies are available that support remediation of tags on existing resources (see
upvoted 4 times
...
akp1000
2 years, 10 months ago
There is also a pre built policy named "Require a tag and its value on resource groups" It uses "Deny"
upvoted 1 times
...
prashantjoge
3 years, 2 months ago
When a policy definition using the append effect is run as part of an evaluation cycle, it doesn't make changes to resources that already exist. Instead, it marks any resource that meets the if condition as non-compliant. https://docs.microsoft.com/en-us/azure/governance/policy/concepts/effects#append-evaluation
upvoted 1 times
prashantjoge
3 years, 2 months ago
For a Resource Manager mode, the deny effect doesn't have any additional properties for use in the then condition of the policy definition. Since additional properties are mentions, it has to be append
upvoted 2 times
...
...
...
Root_Access
Highly Voted 5 years ago
take my word back, if you are denying you dont need to specify tag name and value, but it is defined in the question, so it should be append. my bad.
upvoted 9 times
Chiboy
3 years ago
Yes. If you review the resource Group and the Tag is not there, update the RG with the specified tag.
upvoted 1 times
...
...
e0da014
Most Recent 12 months ago
Final correct answer, verified 1. Microsoft.Resources/subscriptions/resourceGroups 2. Append
upvoted 2 times
...
chloaus
1 year, 2 months ago
2 is append. https://learn.microsoft.com/en-us/azure/governance/policy/concepts/effect-append
upvoted 1 times
...
zapi
1 year, 2 months ago
Microsoft.Resources/subscriptions/resourceGroups DeployIfNotExists That ensures that all resource groups are tagged
upvoted 1 times
...
hydrillo
1 year, 7 months ago
For a deny policy the field and value properies wouldn't be neccessary and append is not for Tag as mentioned in other commends. Therefore I would go for "DeployIfNotExists". Any thoughts on this?
upvoted 1 times
...
gabo
1 year, 8 months ago
I think it's Append, because in the template, the effect is followed by the tag details, so that makes sense only if it's going to do an Append operation. If it's a deny, then what is the point of providing the tag details?
upvoted 1 times
...
Misterit
1 year, 10 months ago
looks correct, many suggest append or deployIfnotExist. but that should not work since there is no configuration in the example that points to an managed identity or service principal with permission to do this action
upvoted 2 times
...
Pukun
2 years ago
{ "name": "Tagging policy", "description": "Policy to require all resource groups to have a tag named organization set to a value of Contoso.", "scope": { "type": "Subscription" }, "policyRule": { "ruleType": "Tag", "resourceType": "Microsoft.Resources/resourceGroups", "tagSpecs": [ { "tagName": "organization", "tagValue": "Contoso" } ], "effect": "Deny" } }
upvoted 1 times
...
DGladiator
2 years ago
GPT4 This policy will deny any resource group creation or update that does not include a tag named 'organization' with a value 'Contoso'.
upvoted 1 times
...
col2511kol
2 years, 2 months ago
In the policy definition, the "then" block defines the action that will be taken when the conditions specified in the "if" block are met. In this case, the action is "effect": "deny". The "deny" effect means that if the conditions in the "if" block are met (i.e., the resource group does not have the required tag or the tag value is not "Contoso"), the policy will deny the creation or update of the resource group. As a result, the user attempting the action will receive an error message indicating that the operation is not allowed due to the policy. In summary, the "then" block with the "effect": "deny" is used to enforce the policy by disallowing the creation or update of resource groups that do not meet the specified tagging requirements.
upvoted 1 times
...
col2511kol
2 years, 2 months ago
You can create and assign a custom Azure Policy to enforce the required tagging for all resource groups in the subscription. Here's an example of the policy definition: { "properties": { "displayName": "Require organization tag", "policyType": "Custom", "mode": "Indexed", "description": "Enforces the existence of the 'organization' tag with the value 'Contoso' on resource groups.", "metadata": { "version": "1.0.0", "category": "Tags" }, "parameters": {}, "policyRule": { "if": { "allof": [ { "field": "type", "equals": "Microsoft.Resources/subscriptions/resourceGroups" }, { "not": { "field": "tags['organization']", "equals": "Contoso" } } ] }, "then": { "effect": "deny" } } } }
upvoted 1 times
...
georgedevops_111
2 years, 5 months ago
The answer is append here is the reference: https://portal.azure.com/#view/Microsoft_Azure_Policy/PolicyDetailBlade/definitionId/%2Fproviders%2FMicrosoft.Authorization%2FpolicyDefinitions%2F49c88fc8-6fd1-46fd-a676-f12d1d3a4c71
upvoted 4 times
...
Oluseun
2 years, 6 months ago
The given answer is correct. The question clearly states that the resourcegroups must have tags as a requirement. If they do not have tags it doesn't say that tags should be automatically added. It is thus logical that the resourcegroup creation should be denied.
upvoted 1 times
...
Atos
2 years, 9 months ago
If you were going to use a deny policy then you wouldn't need the details. It should be append.
upvoted 2 times
...
pdk88
2 years, 9 months ago
I think the given answer is correct. 1. Microsoft.Resources/subscriptions/resourceGroups 2. Deny According to this link (https://docs.microsoft.com/en-us/azure/governance/policy/samples/built-in-policies#tags.) there are eight options with regards to assigning tags to resource groups. This particular case states the tag VALUE 'Contoso' is REQUIRED, hence we are looking for "Require a tag and its value on resource groups". When opening the link belonging to this tag, the policy says: "displayName": "Require a tag and its value on resource groups", "policyType": "BuiltIn", "mode": "All", "description": "Enforces a required tag and its value on resource groups." [...] "then": { "effect": "deny"
upvoted 4 times
...
Darkeh
2 years, 10 months ago
Answer is append. Keyword is "requires." Append will set the value of what is specified in the details. I've done this before with hybrid benefit options on vm builds using a policy in the past.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...