You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/devtest-labs/devtest-lab-attach-detach-data-disk.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,18 @@
1
1
---
2
2
title: Attach or detach data disks for lab VMs
3
-
description: Learn how to attach or detach a data disk for a lab virtual machine (VM) in Azure DevTest Labs.
3
+
description: Learn how to use the Azure portal to attach or detach a data disk for an Azure DevTest Labs virtual machine (VM).
4
4
ms.topic: how-to
5
5
ms.author: rosemalcolm
6
6
author: RoseHJM
7
7
ms.date: 03/14/2025
8
8
ms.custom: UpdateFrequency2
9
+
10
+
#customer intent: As a lab user, I want to attach and detach data disks for my DevTest Labs VMs so I can manage storage or software separately from individual VMs.
9
11
---
10
12
11
13
# Attach or detach a data disk for a lab VM in Azure DevTest Labs
12
14
13
-
This article explains how to attach and detach a lab virtual machine (VM) data disk in Azure DevTest Labs. You can create, attach, detach, and reattach multiple [data disks](/azure/virtual-machines/managed-disks-overview) for your lab VMs. Data disks let you manage storage or software separately from individual VMs.
15
+
This article explains how to attach and detach a lab virtual machine (VM) data disk in Azure DevTest Labs by using the Azure portal. You can create, attach, detach, and reattach multiple [data disks](/azure/virtual-machines/managed-disks-overview) for your lab VMs. Data disks let you manage storage or software separately from individual VMs.
14
16
15
17
## Prerequisites
16
18
@@ -94,7 +96,7 @@ You can also detach or delete a data disk from the lab's page.
94
96
95
97
:::image type="content" source="./media/devtest-lab-attach-detach-data-disk/devtest-lab-detach-data-disk.png" alt-text="Screenshot of detaching a data disk from the listing's context menu.":::
96
98
97
-
To delete a detached data disk, select **Delete** from the context menu on the **My data disks** page, or from the disk's page. Deleting a data disk removes it from storage, and you can't reattach it anymore.
99
+
To delete a detached data disk, select **Delete** from the context menu on the **My data disks** page, or from the disk's page. Deleting a data disk removes it from storage, and you can no longer reattach it.
Copy file name to clipboardExpand all lines: articles/devtest-labs/devtest-lab-concepts.md
+17-16Lines changed: 17 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,27 @@ author: RoseHJM
7
7
ms.date: 03/14/2025
8
8
ms.custom: UpdateFrequency2
9
9
10
-
#customer intent: As a lab user or administrator, I want to understand basic DevTest Labs concepts so I know how I can create, manage, or use labs, VMs, environments, and templates.
10
+
#customer intent: As a lab user or administrator, I want to understand basic DevTest Labs concepts so I know how I can create, manage, and use labs, VMs, environments, and templates.
11
11
---
12
12
13
13
# DevTest Labs concepts
14
14
15
15
This article describes key [Azure DevTest Labs](https://azure.microsoft.com/services/devtest-lab) concepts and definitions. DevTest Labs is a service for easily creating, using, and managing Azure virtual machines (VMs) and other resources.
16
16
17
-
## Roles
17
+
## Labs
18
+
19
+
A DevTest Labs lab is the infrastructure that encompasses a group of resources such as VMs. DevTest Labs administrators can:
20
+
21
+
- Add and configure lab users.
22
+
- Create ready-made VMs for lab users to claim and use.
23
+
- Create and use templates to create and configure labs, VMs, and environments.
24
+
- Connect artifact and template repositories to the lab.
25
+
- Let users create and configure their own lab VMs and environments.
26
+
- Specify allowed virtual machine (VM) limits, sizes, and configurations.
27
+
- Set autoshutdown and autostartup policies.
28
+
- Track and manage lab costs.
29
+
30
+
### Roles
18
31
19
32
[Azure role-based access control (Azure RBAC)](/azure/role-based-access-control/overview) defines DevTest Labs access and roles. DevTest Labs has three roles that define lab member permissions: **Owner**, **Contributor**, and **DevTest Labs User**.
DevTest Labs Users can't modify lab policies, or change any other users' VMs. DevTest Labs Users automatically have Owner permissions on their own VMs.
32
45
33
-
## Labs
34
-
35
-
A DevTest Labs lab is the infrastructure that encompasses a group of resources such as VMs. Lab administrators can:
36
-
37
-
- Add and configure users (Owners only).
38
-
- Create ready-made VMs for lab users to claim and use.
39
-
- Connect artifact and template repositories to the lab.
40
-
- Let users create and configure their own lab VMs and environments.
41
-
- Specify allowed virtual machine (VM) limits, sizes, and configurations.
42
-
- Set autoshutdown and autostartup policies.
43
-
- Track and manage lab costs.
44
-
45
-
### Lab policies
46
+
### Policies
46
47
47
48
Lab policies help control costs and reduce waste. For example, policies can automatically shut down lab VMs based on a defined schedule, or limit the number or sizes of VMs per user or lab. For more information, see [Manage lab policies to control costs](devtest-lab-set-lab-policy.md).
48
49
@@ -100,6 +101,6 @@ For more information about custom images and formulas, see [Compare custom image
100
101
101
102
## Environments
102
103
103
-
A DevTest Labs environment is a collection of Azure platform-as-a-service (PaaS) resources, such as an Azure Web App or a SharePoint farm, defined by an Azure Resource Manager (ARM) template. Lab administrators can add public or privately created environment tamplates to labs, and lab users can use them to quickly create environments. For more information, see [Use ARM templates to create DevTest Labs environments](devtest-lab-create-environment-from-arm.md).
104
+
A DevTest Labs environment is a collection of Azure platform-as-a-service (PaaS) resources, such as an Azure Web App or a SharePoint farm, that's defined by an Azure Resource Manager (ARM) template. Lab administrators can add public or privately created environment tamplates to labs, and lab users can use them to quickly create environments. For more information, see [Use ARM templates to create DevTest Labs environments](devtest-lab-create-environment-from-arm.md).
# Use command lines to start and stop DevTest Labs virtual machines
11
+
#customer intent: As a lab user, I want to use PowerShell or Azure CLI commands to start and stop VMs so I can support automated workflows and save costs.
12
+
---
13
13
14
-
This article shows how to start or stop Azure DevTest Labs virtual machines (VMs) by using Azure PowerShell or Azure CLI command lines and scripts.
14
+
# Use command lines to start and stop DevTest Labs VMs
15
15
16
-
You can start, stop, or [restart DevTest Labs VMs](devtest-lab-restart-vm.md) by using the Azure portal. You can also use the portal to configure [automatic startup](devtest-lab-auto-startup-vm.yml) and [automatic shutdown](devtest-lab-auto-shutdown.md) schedules and policies for lab VMs.
16
+
This article shows how you can use PowerShell or Azure CLI commands to script or automate start or stop for Azure DevTest Labs VMs. For example, you can use start or stop commands to:
17
17
18
-
When you want to script or automate start or stop for lab VMs, use PowerShell or Azure CLI commands. For example, you can use start or stop commands to:
18
+
- Test a three-tier application where the tiers need to start in a sequence.
19
+
- Turn off your VMs to save costs when they meet custom criteria.
20
+
- Start and stop a VM when a continuous integration and continuous delivery (CI/CD) workflow begins and finishes. For an example of this workflow, see [Run an image factory from Azure DevOps](image-factory-set-up-devops-lab.md).
19
21
20
-
- Test a three-tier application, where the tiers need to start in a sequence.
21
-
- Turn off VMs to save costs when they meet custom criteria.
22
-
- Start when a continuous integration and continuous delivery (CI/CD) workflow begins, and stop when it finishes. For an example of this workflow, see [Run an image factory from Azure DevOps](image-factory-set-up-devops-lab.md).
22
+
You can also use the Azure portal to start, stop, or [restart](devtest-lab-restart-vm.md) DevTest Labs VMs. Lab admins can use the portal to configure [automatic startup](devtest-lab-auto-startup-vm.yml) and [automatic shutdown](devtest-lab-auto-shutdown.md) schedules and policies for lab VMs.
23
23
24
24
## Prerequisites
25
25
26
-
- A [lab VM in DevTest Labs](devtest-lab-add-vm.md).
27
-
- For Azure PowerShell, the [Az PowerShell module](/powershell/azure/new-azureps-module-az) installed on your workstation. Make sure you have the latest version. If necessary, run `Update-Module -Name Az` to update the module.
28
-
- For Azure CLI, [Azure CLI ](/cli/azure/install-azure-cli) installed on your workstation.
26
+
- Access to Azure PowerShell. You can [use Azure Cloud Shell](/azure/cloud-shell/quickstart?tabs=powershell) in the Azure portal, or [install Azure PowerShell](/powershell/azure/install-azure-powershell) locally. If necessary, run `Update-Module -Name Az` to update your local installation.
27
+
28
+
- Ownership of a [lab VM in DevTest Labs](devtest-lab-add-vm.md).
29
+
- Access to Azure CLI. You can [use Azure Cloud Shell](/azure/cloud-shell/quickstart?tabs=powershell) in the Azure portal, or install [Azure CLI ](/cli/azure/install-azure-cli) locally.
29
30
30
31
## Azure PowerShell script
31
32
32
-
The following PowerShell script starts or stops a VM in a lab by using [Invoke-AzResourceAction](/powershell/module/az.resources/invoke-azresourceaction). The `ResourceId` parameter is the fully qualified ID for the lab VM you want to start or stop. The `Action` parameter determines whether to start or stop the VM, depending on which action you need.
33
+
The following PowerShell script starts or stops a VM in a lab by using the [Invoke-AzResourceAction](/powershell/module/az.resources/invoke-azresourceaction) PowerShell cmdlet. The `ResourceId` parameter is the fully qualified ID for the lab VM you want to start or stop. The `Action` parameter determines whether to start or stop the VM, depending on which action you need.
33
34
34
-
1.From your workstation, use the PowerShell[Connect-AzAccount](/powershell/module/Az.Accounts/Connect-AzAccount) cmdlet to sign in to your Azure account. If you have multiple Azure subscriptions, uncomment the `Set-AzContext`line and fill in the `<Subscription ID>` you want to use.
35
+
1.In Cloud Shell, make sure the **PowerShell** environment is selected. Use the PowerShell [Connect-AzAccount](/powershell/module/Az.Accounts/Connect-AzAccount) cmdlet to sign in to your Azure account. If you have multiple Azure subscriptions, uncomment `Set-AzContext` and provide the `<SubscriptionId>` you want to use.
35
36
36
37
```powershell
37
38
# Sign in to your Azure subscription
@@ -44,13 +45,11 @@ The following PowerShell script starts or stops a VM in a lab by using [Invoke-A
1. Provide values for the *`<lab name>`* and *`<VM name>`*, and enter which action you want for *`<Start or Stop>`*.
48
+
1. Set variables by providing your own values for `<lab name>`, `<VM name>`, and whether to `Start` or `Stop` the VM.
48
49
49
50
```powershell
50
51
$devTestLabName = "<lab name>"
51
52
$vMToStart = "<VM name>"
52
-
53
-
# The action on the virtual machine (Start or Stop)
54
53
$vmAction = "<Start or Stop>"
55
54
```
56
55
@@ -76,44 +75,43 @@ The following PowerShell script starts or stops a VM in a lab by using [Invoke-A
76
75
77
76
## Azure CLI script
78
77
79
-
The following script provides [Azure CLI](/cli/azure/get-started-with-azure-cli) commands for starting or stopping a lab VM. The variables in this script are for a Windows environment, like a command prompt. Bash or other environments have slight variations.
78
+
The Azure CLI [az lab vm start](/cli/azure/lab/vm#az-lab-vm-start) and [az lab vm stop](/cli/azure/lab/vm#az-lab-vm-stop) commands start or stop a lab VM.
80
79
81
-
1. Provide appropriate values for *`<Subscription ID>`*, *`<lab name>`*, *`<VM name>`*, and the *`<Start or Stop>`* action to take.
82
-
83
-
```azurecli
84
-
set SUBSCRIPTIONID=<Subscription ID>
85
-
set DEVTESTLABNAME=<lab name>
86
-
set VMNAME=<VM name>
87
-
set ACTION=<Start or Stop>
88
-
```
80
+
>[!NOTE]
81
+
>This script assumes a Bash environment. The variables and command for a Windows environment, like a command prompt, have slight variations.
89
82
90
-
1.Sign in to your Azure account. If you have multiple Azure subscriptions, uncomment the `az account set` line to use the subscription ID you provided.
83
+
1. In Cloud Shell, make sure the **Bash** environment is selected, and sign in to your Azure account. If you have multiple Azure subscriptions, uncomment the `az account set` line to use the subscription ID you provide.
91
84
92
85
```azurecli
93
86
az login
94
87
95
-
REM az account set --subscription %SUBSCRIPTIONID%
88
+
REM az account set --subscription <SubscriptionId>
96
89
```
97
90
98
-
1.Get the name of the resource group that contains the lab.
91
+
1.Set variables by providing values for `<SubscriptionId>`, `<resourceGroup>`, `<lab name>`, `<VM name>`, and whether to `Start` or `Stop`the VM.
99
92
100
93
```azurecli
101
-
az resource list --resource-type "Microsoft.DevTestLab/labs" --name %DEVTESTLABNAME% --query "[0].resourceGroup"
94
+
SUBSCRIPTIONID=<SubscriptionId>
95
+
RESOURCEGROUP=<resourceGroup>
96
+
DEVTESTLABNAME=<lab name>
97
+
VMNAME=<VM name>
98
+
ACTION=<Start or Stop>
102
99
```
103
100
104
-
1. Replace *`<resourceGroup>`* with the value you got from the previous step.
101
+
>[!TIP]
102
+
>If you don't know the name of the Azure resource group that contains your lab, you can find it by providing your `<lab name>` in the following query.
105
103
106
104
```azurecli
107
-
set RESOURCEGROUP=<resourceGroup>
105
+
az resource list --resource-type "Microsoft.DevTestLab/labs" --name "<LabName>" --query "[0].resourceGroup"
108
106
```
109
107
110
-
1. Run the command line to start or stop the VM, based on the value you passed to `ACTION`.
108
+
1. Run the following Azure CLI command to start or stop the VM, based on the value passed to `ACTION`.
111
109
112
110
```azurecli
113
-
az lab vm %ACTION% --lab-name %DEVTESTLABNAME% --name %VMNAME% --resource-group %RESOURCEGROUP%
111
+
az lab vm $ACTION --lab-name $DEVTESTLABNAME --name $VMNAME --resource-group $RESOURCEGROUP
0 commit comments