Mod 11 - Lab - Role-Based Access Control
Mod 11 - Lab - Role-Based Access Control
Scenario
Lab: Role-Based Access Control
All tasks in this lab are performed from the Azure portal (including a PowerShell Cloud Shell session)
Objectives
Exercise 1:
❕ Note: When not using Cloud Shell, the lab virtual machine must have the Azure PowerShell 1.2.0 module (or newer) installed
Configure
delegation of https://docs.microsoft.com/en-us/powershell/azure/install-az-ps
provisioning
and
management of Lab files: none
Azure resources
by using built-in
Role-Based Scenario
Access Control
(RBAC) roles and
built-in Azure Adatum Corporation wants to use Azure Role Based Access Control and Azure Policy to control provisioning and
policies management of their Azure resources. It also wants to be able to automate and track provisioning and
management tasks.
Exercise 2: Verify
delegation by
provisioning Objectives
Azure resources
as a delegated
After completing this lab, you will be able to:
admin and
auditing
provisioning Configure delegation of provisioning and management of Azure resources by using built-in Role-Based
events Access Control (RBAC) roles and built-in Azure policies
Verify delegation by provisioning Azure resources as a delegated admin and auditing provisioning events
1. From the lab virtual machine, start Microsoft Edge, browse to the Azure portal at http://portal.azure.com
and sign in by using a Microsoft account that has the Owner role in the Azure subscription you intend to
use in this lab and is a Global Administrator of the Azure AD tenant associated with that subscription.
3. From the Azure Active Directory blade, navigate to the Custom domain names blade and identify the
primary DNS domain name associated the Azure AD tenant. Note its value - you will need it later in this
task.
4. From the Azure AD Custom domain names blade, navigate to the Users - All users blade.
5. From the Users - All users blade, create a new user with the following settings:
Name: aaduser100011
Auto-generate password
Password: select the checkbox Show Password and note the string appearing in the Password text
box. You will need it later in this lab.
Roles: User
6. From the Users - All users blade, navigate to the Groups - All groups blade.
7. From the Groups - All groups blade, create a new group with the following settings:
Members: aaduser100011
2. From the Resource groups blade, create the first resource group with the following settings:
Subscription: the name of the subscription you are using in this lab
Resource group location: the name of the Azure region which is closest to the lab location and where
you can provision Azure VMs.
3. From the Resource groups blade, create the second resource group with the following settings:
Subscription: the name of the subscription you selected in the previous step
Resource group location: the name of the Azure region you selected in the previous step
Task 3: Delegate management of an Azure resource group via a built-in RBAC role
1. In the Azure portal, from the Resource groups blade, navigate to the az1000101-RG blade.
2. From the az1000101-RG blade, display its Access control (IAM) blade.
3. From the az1000101-RG - Access control (IAM) blade, display the Role assignments blade.
4. From the Role assignments blade, create the following role assignment:
Role: Contributor
2. From the Policy - Compliance blade, display the Assign policy blade.
Basics tab:
Parameters tab:
Remediation tab:
❕ Result: After you completed this exercise, you have created an Azure AD user and an Azure AD group, created two Azure
resource groups, delegated management of the first Azure resource group via the built-in Azure VM Contributor RBAC role,
and assigned to the same resource group the built-in Azure policy restricting SKUs that can be used for Azure VMs.
1. From the Azure Portal, start a PowerShell session in the Cloud Shell.
❕ Note: If this is the first time you are launching the Cloud Shell in the current Azure subscription, you will be asked to
create an Azure file share to persist Cloud Shell files. If so, accept the defaults, which will result in creation of a storage
account in an automatically generated resource group.
2. In the Cloud Shell pane, run the following command, substituting the placeholder <custom-label> with
any string which is likely to be unique and the placeholder <location-of-az1000101-RG> with the name
of the Azure region in which you created the az1000101-RG resource group.
Code Copy
3. Verify that the command returned True. If not, rerun the same command with a different value of the
<custom-label> until the command returns True.
4. Note the value of the <custom-label> that resulted in the successful outcome. You will need it in the next
task
Code Copy
Code Copy
❕ Note: These cmdlets register the Azure Resource Manager Microsoft.Network and Microsoft.Compute resource
providers. This is a one-time operation (per subscription) required when using Azure Resource Manager templates to
deploy resources managed by these resource providers (if these resource providers have not been yet registered).
❕ Also Note: If you encounter an error after running these commands that mentions a token expiry set to a time that is
before the current time, click the power button icon on our Cloud Shell UI and reboot your Cloud Shell instance. Once
restarted, retry these commands.
2. In the new browser window, navigate to the Azure portal and sign in using the user account
aaduser100011@<DNS-domain-name> where <DNS-domain-name> represents the primary DNS
domain name you identified earlier. When prompted, change the password to a new value.
3. In the Azure portal, navigate to the Resource groups blade and note that you can view only the resource
group az1000101-RG.
5. From the New blade, search Azure Marketplace for Template deployment.
6. Use the list of search results to navigate to the Deploy a custom template blade.
7. On the Custom deployment blade, in the Load a GitHub quickstart template drop-down list, select the
101-vm-simple-linux entry and navigate to the Edit template blade.
8. On the Edit template blade, navigate to the Variables section and locate the vmSize entry.
10. Discard any changes you might have made to the template and navigate to the Deploy a simple Ubuntu
Linux VM blade.
11. From the Deploy a simple Ubuntu Linux VM blade, initiate a template deployment with the following
settings:
Location: the name of the Azure region which you selected in the previous exercise
Dns Label Prefix: the <custom-label> you identified in the previous task
12. Note that the initiation of the deployment fails. Navigate to the Errors blade and note that the deployment
of the resource is not allowed by the policy Allowed virtual machine SKUs.
1. From the Deploy a simple Ubuntu Linux VM blade, navigate to the Edit parameters blade.
3. Replace the value Standard_B2s with Standard_DS1_v2 and save the change.
5. Do not wait for the deployment to complete but proceed to the next task.
1. Switch to the browser window that you used in the previous exercise.
3. From the az1000101-RG resource group blade, display its Activity log blade.
4. In the list of operations, note the ones corresponding to the failed and successful validation events.
5. Refresh the view of the blade and observe events corresponding to the Azure VM provisioning, including
the final one representing the successful deployment.
❕ Result: After you completed this exercise, you have identified an available DNS name for an Azure VM deployment,
attempted an automated deployment of a policy non-compliant Azure VM as a delegated admin, performed an automated
deployment of a policy compliant Azure VM as the same delegated admin, and reviewed Azure Activity Log entries
corresponding to both Azure VM deployments.
1. At the top of the portal, click the Cloud Shell icon to open the Cloud Shell pane.
3. At the Cloud Shell command prompt, type in the following command and press Enter to list all resource
groups you created in this lab:
Shell Copy
4. Verify that the output contains only the resource groups you created in this lab. These groups will be
deleted in the next task.
1. At the Cloud Shell command prompt, type in the following command and press Enter to delete the
resource groups you created in this lab
Shell Copy
❕ Result: In this exercise, you removed the resources used in this lab.