{
    "id": "b5abf285-3931-4775-8d13-996c63ac790e",
    "name": "Enforcing Resource Tagging",
    "slug": "enforcing-resource-tagging",
    "status": "published",
    "lab_type": "azure",
    "is_sample": false,
    "duration_in_seconds": 1200,
    "metadata": {},
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2020-08-11T12:14:13.105383Z",
    "modified": "2023-10-03T18:58:58.627958Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": null,
    "learning_areas": [],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": false,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "is_trackable": false,
    "cpe_credits": null,
    "is_skill_check": false,
    "external_url": "https://portal.azure.com/",
    "solution_video": "5bb2fc98-ab60-4e20-8739-f2381ce90e77",
    "explanation_video": null,
    "description": "# Task: Enforcing resource tagging\r\n\r\n## Video: Data Security in Azure\r\n\r\n**Estimated time:** 10 minutes\r\n\r\n## Goal\r\n\r\nIn this task you will create a custom policy that requires resources to have a specific tag with a limited set of valid values.  You will assign this policy to a resource group and verify the policy.\r\n\r\n## Pre-requisites\r\n\r\n1. Non-production Azure subscription\r\n\r\n## Requirements\r\n\r\n1. Create a custom policy requiring tagging\r\n2. Assign the policy to a resource group\r\n3. Test the policy\r\n\r\n---\r\n\r\n## Pre-requisite setup\r\n\r\nThis task does not require any pre-requisite setup.\r\n\r\n## Requirement 1:  Create a custom policy requiring tagging\r\n\r\nTo begin this task you will Create a custom policy named **RequireSensitivity**. This policy will require that all resources governed by the policy have a **Sensitivity** tag with a value that matches one of the following:\r\n\r\n- Public\r\n- General\r\n- Sensitive\r\n- Highly Sensitive\r\n\r\nTo complete this requirement:\r\n\r\n- Navigate to the **Policy** blade of the Azure portal\r\n- Add a policy definition with the following settings:\r\n  |      Setting | Value                               |\r\n  | -----------: | ----------------------------------- |\r\n  |     Location | **&lt;your subscription&gt;**       |\r\n  |         Name | **SensitivityTag**                  |\r\n  |  Description | **&lt;a meaningful description&gt;** |\r\n  |     Category | Data security                       |\r\n  | Policy rule: |                                     |\r\n\r\n  ```json\r\n  {\r\n    \"mode\":\"All\",\r\n    \"policyRule\": {\r\n      \"if\": {\r\n        \"allof\": [\r\n          {\r\n            \"not\": {\r\n              \"field\": \"type\",\r\n              \"equals\": \"Microsoft.Resources/subscriptions/resourceGroups\"\r\n            }\r\n          },\r\n          {\r\n            \"anyof\": [\r\n              {\r\n                \"field\": \"tags['Sensitivity']\",\r\n                \"exists\": false\r\n              },\r\n              {\r\n                \"not\":{\r\n                  \"field\": \"tags['Sensitivity']\",\r\n                  \"in\":[\"Public\",\"General\",\"Confidential\",\"Highly confidential\"]\r\n                }\r\n              }\r\n            ]\r\n          }\r\n        ]\r\n      },\r\n      \"then\": {\r\n        \"effect\": \"deny\"\r\n      }\r\n    }\r\n  }\r\n  ```\r\n\r\n## Requirement 2: Assign the policy to a resource group\r\n\r\nNext you will provision a resource group named **task-datasec-rg**.  You will then assign the **SensitivityTag** policy to the **task-datasec-rg** resource group.\r\n\r\n## Requirement 3: Test the policy\r\n\r\nFinally, you will attempt to provision a storage account in the **task-datasec-rg** resource group.  You will make three attempts at provisioning the storage account:\r\n\r\n- Attempt to provision the storage account with no tags.  This should fail.\r\n- Attempt to provision the storage account with a **Sensitivity** tag set to **unknown**. This should fail.\r\n- Attempt to provision the storage account with a **Sensitivity** tag set to **Public**. This should succeed.\r\n\r\n## Clean up\r\n\r\n- Delete the **task-datasec-rg** resource group.\r\n- Delete the SensitivityTag policy.\r\n\r\n## Solution\r\n\r\nHaving trouble completing this task?  View the demonstration video to see how to do it.\r\n",
    "description_html": "<h1>Task: Enforcing resource tagging</h1>\n<h2>Video: Data Security in Azure</h2>\n<p><strong>Estimated time:</strong> 10 minutes</p>\n<h2>Goal</h2>\n<p>In this task you will create a custom policy that requires resources to have a specific tag with a limited set of valid values.  You will assign this policy to a resource group and verify the policy.</p>\n<h2>Pre-requisites</h2>\n<ol>\n<li>Non-production Azure subscription</li>\n</ol>\n<h2>Requirements</h2>\n<ol>\n<li>Create a custom policy requiring tagging</li>\n<li>Assign the policy to a resource group</li>\n<li>Test the policy</li>\n</ol>\n<hr />\n<h2>Pre-requisite setup</h2>\n<p>This task does not require any pre-requisite setup.</p>\n<h2>Requirement 1:  Create a custom policy requiring tagging</h2>\n<p>To begin this task you will Create a custom policy named <strong>RequireSensitivity</strong>. This policy will require that all resources governed by the policy have a <strong>Sensitivity</strong> tag with a value that matches one of the following:</p>\n<ul>\n<li>Public</li>\n<li>General</li>\n<li>Sensitive</li>\n<li>Highly Sensitive</li>\n</ul>\n<p>To complete this requirement:</p>\n<ul>\n<li>Navigate to the <strong>Policy</strong> blade of the Azure portal</li>\n<li>Add a policy definition with the following settings:\n  |      Setting | Value                               |\n  | -----------: | ----------------------------------- |\n  |     Location | <strong>&lt;your subscription&gt;</strong>       |\n  |         Name | <strong>SensitivityTag</strong>                  |\n  |  Description | <strong>&lt;a meaningful description&gt;</strong> |\n  |     Category | Data security                       |\n  | Policy rule: |                                     |</li>\n</ul>\n<pre class=\"codehilite\"><code class=\"language-json\">{\n  \"mode\":\"All\",\n  \"policyRule\": {\n    \"if\": {\n      \"allof\": [\n        {\n          \"not\": {\n            \"field\": \"type\",\n            \"equals\": \"Microsoft.Resources/subscriptions/resourceGroups\"\n          }\n        },\n        {\n          \"anyof\": [\n            {\n              \"field\": \"tags['Sensitivity']\",\n              \"exists\": false\n            },\n            {\n              \"not\":{\n                \"field\": \"tags['Sensitivity']\",\n                \"in\":[\"Public\",\"General\",\"Confidential\",\"Highly confidential\"]\n              }\n            }\n          ]\n        }\n      ]\n    },\n    \"then\": {\n      \"effect\": \"deny\"\n    }\n  }\n}</code></pre>\n\n<h2>Requirement 2: Assign the policy to a resource group</h2>\n<p>Next you will provision a resource group named <strong>task-datasec-rg</strong>.  You will then assign the <strong>SensitivityTag</strong> policy to the <strong>task-datasec-rg</strong> resource group.</p>\n<h2>Requirement 3: Test the policy</h2>\n<p>Finally, you will attempt to provision a storage account in the <strong>task-datasec-rg</strong> resource group.  You will make three attempts at provisioning the storage account:</p>\n<ul>\n<li>Attempt to provision the storage account with no tags.  This should fail.</li>\n<li>Attempt to provision the storage account with a <strong>Sensitivity</strong> tag set to <strong>unknown</strong>. This should fail.</li>\n<li>Attempt to provision the storage account with a <strong>Sensitivity</strong> tag set to <strong>Public</strong>. This should succeed.</li>\n</ul>\n<h2>Clean up</h2>\n<ul>\n<li>Delete the <strong>task-datasec-rg</strong> resource group.</li>\n<li>Delete the SensitivityTag policy.</li>\n</ul>\n<h2>Solution</h2>\n<p>Having trouble completing this task?  View the demonstration video to see how to do it.</p>",
    "tasks": "",
    "tasks_html": "",
    "published_date": "2020-06-16T15:57:29Z",
    "solutions": "",
    "solutions_html": "",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "default",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": []
}