Skip to content

Commit 5b578aa

Browse files
Merge pull request #209008 from RoseHJM/azlab-azure-policies
New concept article and how to for Lab Services Azure policies
2 parents d31914c + f625d04 commit 5b578aa

16 files changed

+182
-0
lines changed

articles/lab-services/TOC.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
href: capacity-limits.md
6161
- name: Cost management for labs
6262
href: cost-management-guide.md
63+
- name: Azure Policies for Lab Services
64+
href: azure-polices-for-lab-services.md
6365
- name: Reliability
6466
items:
6567
- name: Reliability in Azure Lab Services
@@ -163,6 +165,8 @@
163165
href: how-to-configure-firewall-settings.md
164166
- name: Configure regions for labs
165167
href: create-and-configure-labs-admin.md
168+
- name: Restrict VM sizes allowed for labs
169+
href: how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy.md
166170
- name: Create & configure labs (educator)
167171
items:
168172
- name: Create and manage labs
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: Azure Policies for Lab Services
3+
description: This article describes the policies available for Azure Lab Services.
4+
ms.topic: conceptual
5+
ms.author: rosemalcolm
6+
author: RoseHJM
7+
ms.date: 08/15/2022
8+
---
9+
10+
# What’s new with Azure Policy for Lab Services?
11+
12+
Azure Policy helps you manage and prevent IT issues by applying policy definitions that enforce rules and effects for your resource. Azure Lab Services has added four built-in Azure policies. This article summarizes the new policies available in the August 2022 Update for Azure Lab Services.
13+
14+
1. Lab Services should enable all options for auto shutdown
15+
1. Lab Services should not allow template virtual machines for labs
16+
1. Lab Services should require non-admin user for labs
17+
1. Lab Services should restrict allowed virtual machine SKU sizes
18+
19+
For a full list of built-in policies, including policies for Lab Services, see [Azure Policy built-in policy definitions](/azure/governance/policy/samples/built-in-policies#lab-services).
20+
21+
22+
23+
[!INCLUDE [lab plans only note](./includes/lab-services-new-update-focused-article.md)]
24+
25+
## Lab Services should enable all options for auto shutdown
26+
27+
This policy enforces that all [shutdown options](how-to-configure-auto-shutdown-lab-plans.md) are enabled while creating the lab. During policy assignment, lab administrators can choose the following effects.
28+
29+
|**Effect**|**Behavior**|
30+
|-----|-----|
31+
|**Audit**|Labs will show on the [compliance dashboard](/azure/governance/policy/assign-policy-portal#identify-non-compliant-resources) as non-compliant when all shutdown options are not enabled for a lab. |
32+
|**Deny**|Lab creation will fail if all shutdown options are not enabled. |
33+
34+
## Lab Services should not allow template virtual machines for labs
35+
36+
This policy can be used to restrict [customization of lab templates](tutorial-setup-lab.md). When you create a new lab, you can select to *Create a template virtual machine* or *Use virtual machine image without customization*. If this policy is enabled, only *Use virtual machine image without customization* is allowed. During policy assignment, lab administrators can choose the following effects.
37+
38+
|**Effect**|**Behavior**|
39+
|-----|-----|
40+
|**Audit**|Labs will show on the [compliance dashboard](/azure/governance/policy/assign-policy-portal#identify-non-compliant-resources) as non-compliant when a template virtual machine is used for a lab.|
41+
|**Deny**|Lab creation to fail if “create a template virtual machine” option is used for a lab.|
42+
43+
## Lab Services require non-admin user for labs
44+
45+
This policy is used to enforce using non-admin accounts while creating a lab. With the August 2022 Update, you can choose to add a non-admin account to the VM image. This new feature allows you to keep separate credentials for VM admin and non-admin users. For more information to create a lab with a non-admin user, see [Tutorial: Create and publish a lab](tutorial-setup-lab.md#create-a-lab), which shows how to give a student non-administrator account rather than default administrator account on the “Virtual machine credentials” page of the new lab wizard.
46+
47+
During the policy assignment, the lab administrator can choose the following effects.
48+
49+
|**Effect**|**Behavior**|
50+
|-----|-----|
51+
|**Audit**|Labs show on the [compliance dashboard](/azure/governance/policy/assign-policy-portal#identify-non-compliant-resources) as non-compliant when non-admin accounts is not used while creating the lab.|
52+
|**Deny**|Lab creation will fail if “Give lab users a non-admin account on their virtual machines” is not checked while creating a lab.|
53+
54+
## Lab Services should restrict allowed virtual machine SKU sizes
55+
This policy is used to enforce which SKUs can be used while creating the lab. For example, a lab administrator might want to prevent educators from creating labs with GPU SKUs since they are not needed for any classes being taught. This policy would allow lab administrators to enforce which SKUs can be used while creating the lab.
56+
During the policy assignment, the Lab Administrator can choose the following effects.
57+
58+
|**Effect**|**Behavior**|
59+
|-----|-----|
60+
|**Audit**|Labs show on the [compliance dashboard](/azure/governance/policy/assign-policy-portal#identify-non-compliant-resources) as non-compliant when a non-allowed SKU is used while creating the lab.|
61+
|**Deny**|Lab creation will fail if SKU chosen while creating a lab is not allowed as per the policy assignment.|
62+
63+
## Next steps
64+
65+
See the following articles:
66+
- [How to use the Lab Services should restrict allowed virtual machine SKU sizes Azure policy](how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy.md)
67+
- [Built-in Policies](/azure/governance/policy/samples/built-in-policies#lab-services)
68+
- [What is Azure policy?](/azure/governance/policy/overview)
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
title: How to restrict the virtual machine sizes allowed for labs
3+
description: Learn how to use the Lab Services should restrict allowed virtual machine SKU sizes Azure Policy to restrict educators to specified virtual machine sizes for their labs.
4+
ms.topic: how-to
5+
ms.author: rosemalcolm
6+
author: RoseHJM
7+
ms.date: 08/23/2022
8+
---
9+
10+
# How to restrict the virtual machine sizes allowed for labs
11+
12+
In this how to, you'll learn how to use the *Lab Services should restrict allowed virtual machine SKU sizes* Azure policy to control the SKUs available to educators when they're creating labs. In this example, you'll see how a lab administrator can allow only non-GPU SKUs, so educators can create only non-GPU SKU labs.
13+
14+
[!INCLUDE [lab plans only note](./includes/lab-services-new-update-focused-article.md)]
15+
16+
## Configure the policy
17+
18+
1. In the [Azure portal](https://portal.azure.com), go to your subscription.
19+
20+
1. From the left menu, under **Settings**, select **Policies**.
21+
22+
1. Under **Authoring**, select **Assignments**.
23+
24+
1. Select **Assign Policy**.
25+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy.png" alt-text="Screenshot showing the Policy Compliance dashboard with Assign policy highlighted.":::
26+
27+
1. Select the **Scope** which you would like to assign the policy to, and then select **Select**.
28+
You can also select a resource group if you need the policy to apply more granularly.
29+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-basics-scope.png" alt-text="Screenshot showing the Scope pane with subscription highlighted.":::
30+
31+
1. Select Policy Definition. In Available definitions, search for *Lab Services*, select **Lab Services should restrict allowed virtual machine SKU sizes** and then select **Select**.
32+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-basics-definitions.png" alt-text="Screenshot showing the Available definitions pane with Lab Services should restrict allowed virtual machine SKU sizes highlighted. ":::
33+
34+
1. On the Basics tab, select **Next**.
35+
36+
1. On the Parameters tab, clear **Only show parameters that need input or review** to show all parameters.
37+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-parameters.png" alt-text="Screenshot showing the Parameters tab with Only show parameters that need input or review highlighted. ":::
38+
39+
1. The **Allowed SKU names** parameter shows the SKUs allowed when the policy is applied. By default all the available SKUs are allowed. You must clear the check boxes for any SKU that you don't wish to allow educators to use to create labs. In this example, only the following non-GPU SKUs are allowed:
40+
- CLASSIC_FSV2_2_4GB_128_S_SSD
41+
- CLASSIC_FSV2_4_8GB_128_S_SSD
42+
- CLASSIC_FSV2_8_16GB_128_S_SSD
43+
- CLASSIC_DSV4_4_16GB_128_P_SSD
44+
- CLASSIC_DSV4_8_32GB_128_P_SSD
45+
46+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-parameters-vms.png" alt-text="Screenshot showing the Allowed SKUs.":::
47+
48+
Use the table below to determine which SKU names to apply.
49+
50+
|SKU Name|VM Size|VM Size Details|
51+
|-----|-----|-----|
52+
|CLASSIC_FSV2_2_4GB_128_S_SSD| Small |2vCPUs, 4 GB RAM, 128 GB, Standard SSD
53+
|CLASSIC_FSV2_4_8GB_128_S_SSD| Medium |4vCPUs, 8 GB RAM, 128 GB, Standard SSD
54+
|CLASSIC_FSV2_8_16GB_128_S_SSD| Large |8vCPUs, 16 GB RAM, 128 GB, Standard SSD
55+
|CLASSIC_DSV4_4_16GB_128_P_SSD| Medium (Nested virtualization) |4 vCPUs, 16 GB RAM, 128 GB, Premium SSD
56+
|CLASSIC_DSV4_8_32GB_128_P_SSD| Large (Nested virtualization) |8vCPUs, 32 GB RAM, 128 GB, Premium SSD
57+
|CLASSIC_NCSV3_6_112GB_128_S_SSD| Small GPU (Compute) |6vCPUs, 112 GB RAM, 128 GB, Standard SSD
58+
|CLASSIC_NVV4_8_28GB_128_S_SSD| Small GPU (Visualization) |8vCPUs, 28 GB RAM, 128 GB, Standard SSD
59+
|CLASSIC_NVV3_12_112GB_128_S_SSD| Medium GPU (Visualization) |12vCPUs, 112 GB RAM, 128 GB, Standard SSD
60+
61+
1. In **Effect**, select **Deny**. Selecting deny will prevent a lab from being created if an educator tries to use a GPU SKU.
62+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-parameters-effect.png" alt-text="Screenshot showing the effect list.":::
63+
64+
1. Select **Next**.
65+
66+
1. On the Remediation tab, select **Next**.
67+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-remediation.png" alt-text="Screenshot showing the Remediation tab with Next highlighted.":::
68+
69+
1. On the Non-compliance tab, in **Non-compliance messages**, enter a non-compliance message of your choice like “Selected SKU is not allowed”, and then select **Next**.
70+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-message.png" alt-text="Screenshot showing the Non-compliance tab with an example non-compliance message.":::
71+
72+
1. On the Review + Create tab, select **Create** to create the policy assignment.
73+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-review-create.png" alt-text="Screenshot showing the Review and Create tab.":::
74+
75+
You've created a policy assignment for *Lab Services should restrict allowed virtual machine SKU sizes* and allowed only the use of non-GPU SKUs for labs. Attempting to create a lab with any other SKU will fail.
76+
77+
> [!NOTE]
78+
> New policy assignments can take up to 30 minutes to take effect.
79+
80+
## Exclude resources
81+
82+
When applying a built-in policy, you can choose to exclude certain resources, with the exception of lab plans. For example, if the scope of your policy assignment is a subscription, you can exclude resources in a specified resource group. Exclusions are configured using the Exclusions property on the Basics tab when creating a policy definition.
83+
84+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-basics-exclusions.png" alt-text="Screenshot showing the Basics tab with Exclusions highlighted.":::
85+
86+
87+
## Exclude a lab plan
88+
89+
Lab plans cannot be excluded using the Exclusions property on the Basics tab. To exclude a lab plan from a policy assignment, you first need to get the lab plan resource ID, and then use it to specify the lab pan you want to exclude on the Parameters tab.
90+
91+
### Locate and copy lab plan resource ID
92+
Use the following steps to locate and copy the resource ID so that you can paste it into the exclusion configuration.
93+
1. In the [Azure portal](https://portal.azure.com), go to the lab plan you want to exclude.
94+
95+
1. Under Settings, select Properties, and then copy the **Resource ID**.
96+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/resource-id.png" alt-text="Screenshot showing the lab plan properties with resource ID highlighted.":::
97+
98+
### Enter the lab plan to exclude in the policy
99+
Now you have a lab plan resource ID, you can use it to exclude the lab plan as you assign the policy.
100+
1. On the Parameters tab, clear **Only show parameters that need input or review**.
101+
1. For **Lab Plan ID to exclude**, enter the lab plan resource ID you copied earlier.
102+
:::image type="content" source="./media/how-to-use-restrict-allowed-virtual-machine-sku-sizes-policy/assign-policy-exclude-lab-plan-id.png" alt-text="Screenshot showing the Parameter tab with Lab Plan ID to exclude highlighted.":::
103+
104+
105+
## Next steps
106+
See the following articles:
107+
- [What’s new with Azure Policy for Lab Services?](azure-polices-for-lab-services.md)
108+
- [Built-in Policies](/azure/governance/policy/samples/built-in-policies#lab-services)
109+
- [What is Azure policy?](/azure/governance/policy/overview)
110+
Loading
Loading
Loading
65.9 KB
Loading
Loading
46.8 KB
Loading
Loading

0 commit comments

Comments
 (0)