De Wiki Clusterlab.com.br
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação
Ir para pesquisar
#!/bin/bash
#az snapshot create -n nome -g rg --sku Standard_LRS --source
#storageProfile.[osDisk.[name,managedDisk.[id]],dataDisks[*].[name,managedDisk.[id]]]
#export STRING_OSDISK=storageProfile.osDisk.[name,managedDisk.id]
#export STRING_DATADISK=storageProfile.dataDisks[*].[name,managedDisk.id]
export STRING_OSDISK=storageProfile.osDisk.managedDisk.id
export STRING_DATADISK=storageProfile.dataDisks[*].managedDisk.id
export RG=
export VMNAME=
export SUFIX=
az vm show \
--name $VMNAME \
-g $RG \
-d \
--query "$STRING_OSDISK" \
-o tsv | while read diskid
do
name=$(echo $diskid | tr '/' '\n' | tail -n 1)
echo az snapshot create \
-n $VMNAME-so-$SUFIX \
-g $RG \
--sku Standard_LRS \
--source $diskid
done
az vm show \
--name $VMNAME \
-g $RG \
-d \
--query "$STRING_DATADISK" \
-o tsv | while read diskid
do
name=$(echo $diskid | tr '/' '\n' | tail -n 1)
echo az snapshot create \
-n $name-$SUFIX \
-g $RG \
--sku Standard_LRS \
--source $diskid
done