Skip to content

Commit b0caf73

Browse files
Merge pull request #265518 from roygara/esanSnaps
Adding PowerShell and CLI
2 parents 24ff6bb + b31722c commit b0caf73

File tree

1 file changed

+55
-3
lines changed

1 file changed

+55
-3
lines changed

articles/storage/elastic-san/elastic-san-snapshots.md

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: roygara
55
ms.service: azure-elastic-san-storage
66
ms.custom: devx-track-azurepowershell
77
ms.topic: conceptual
8-
ms.date: 02/13/2024
8+
ms.date: 03/11/2024
99
ms.author: rogarana
1010
---
1111

@@ -147,10 +147,62 @@ az elastic-san volume snapshot delete -g "resourceGroupName" -e "san_name" -v "v
147147

148148
## Export volume snapshot
149149

150-
Elastic SAN volume snapshots are automatically deleted when the volume is deleted. If you need your snapshot's data to persist beyond deletion, export them to managed disk snapshots. The export process will take time and will depend on the size of the snapshot. You can check how much is left before completion by checking the CompletionPercentage property of the managed disk snapshot. Once you export an elastic SAN snapshot to a managed disk snapshot, the managed disk snapshot begins to incur billing charges. Elastic SAN snapshots don't have any extra billing associated with them, they only consume your elastic SAN's capacity.
150+
Elastic SAN volume snapshots are automatically deleted when the volume is deleted. For your snapshot's data to persist beyond deletion, export them to managed disk snapshots. Exporting a volume snapshot to a managed disk snapshot takes time, how much time it takes depend on the size of the snapshot. You can check how much is left before completion by checking the `CompletionPercentage` property of the managed disk snapshot.
151151

152-
Currently, you can only export snapshots using the Azure portal. The Azure PowerShell module and the Azure CLI can't be used to export snapshots.
152+
### Billing implications
153+
154+
Elastic SAN snapshots don't have any extra billing associated with them, they only consume your elastic SAN's capacity. Once you export an elastic SAN snapshot to a managed disk snapshot, the managed disk snapshot begins to incur billing charges.
155+
156+
# [Portal](#tab/azure-portal)
153157

154158
1. Navigate to your elastic SAN and select **Volume snapshots**.
155159
1. Select a volume group, then select the snapshot you'd like to export.
156160
1. Select Export and fill out the details, then select **Export**.
161+
162+
# [PowerShell](#tab/azure-powershell)
163+
164+
Replace the variables in the following script, then run it:
165+
166+
```azurepowershell
167+
$elasticSanName = <nameHere>
168+
$volGroupName = <nameHere>
169+
$region = <yourRegion>
170+
$rgName = <yourResourceGroupName>
171+
$elasticSanSnapshotName = <ElasticSanSnapshotName>
172+
$newSnapName = <NameOfNewSnapshot>
173+
174+
$elasticSanVolumeSnapshotResourceId = (Get-AzElasticSanVolumeSnapshot -ElasticSanName $elasticSanName -ResourceGroupName $rgName -VolumeGroupName $volGroupName -name $elasticSanSnapshotName).Id
175+
176+
$snapshotconfig = New-AzSnapshotConfig -Location $region -AccountType Standard_LRS -CreateOption CopyFromSanSnapshot -ElasticSanResourceId $elasticSanVolumeSnapshotResourceId
177+
New-AzSnapshot -ResourceGroupName $rgName -SnapshotName $newSnapName -Snapshot $snapshotconfig;
178+
```
179+
180+
181+
# [Azure CLI](#tab/azure-cli)
182+
183+
Replace the variables in the following script, then run it:
184+
185+
```azurecli
186+
region=<yourRegion>
187+
rgName=<ResourceGroupName>
188+
sanName=<yourElasticSANName>
189+
vgName=<yourVolumeGroupName>
190+
sanSnapName=<yourElasticSANSnapshotName>
191+
diskSnapName=<nameForNewDiskSnapshot>
192+
193+
snapID=$(az elastic-san volume snapshot show -g $rgName -e $sanName -v $vgName -n $sanSnapName --query 'id' | tr -d \"~)
194+
195+
az snapshot create -g $rgName --name $diskSnapName --elastic-san-id $snapID --location $region
196+
```
197+
198+
199+
---
200+
201+
## Create volumes from disk snapshots
202+
203+
Currently, you can only use the Azure portal to create Elastic SAN volumes from managed disks snapshots. The Azure PowerShell module and the Azure CLI can't be used to create Elastic SAN volumes from managed disk snapshots. Managed disk snapshots must be in the same region as your elastic SAN to create volumes with them.
204+
205+
1. Navigate to your SAN and select **volumes**.
206+
1. Select **Create volume**.
207+
1. For **Source type** select **Disk snapshot** and fill out the rest of the values.
208+
1. Select **Create**.

0 commit comments

Comments
 (0)