Vathsa's Cloud - Command Line steps and examples


Azure Command Line 

 Azure Create Custom OS Image & Deploy VM's :


az vm deallocate --resource-group atbial --name atbialServer

az vm generalize --resource-group atbial --name atbialServer

az image create --resource-group atbial --name atcentos7.4 --source atbialServer


az vm create --resource-group at_test_all --name atFrmImg --image "/subscriptions/a4d11e3d-98db-4857-b50e-6813049bbc66/resourceGroups/atbial/providers/Microsoft.Compute/images/atcentos74" --generate-ssh-keys


How To Delete Storage Disk

az disk list --output table

az disk delete --resource-group ECOMM --name azraybanstg_OsDisk_1_acf662ac54724ef08ebf64d58fff3df8


CREATE VM Using Existing Image  Step By Step (DR Script) 


## Copy OS disk from Central India to SouthIndia DC storage account

az disk copy-to-vhd --account-name acebialrstorage --destination-blob bialprodOSdisk.vhd  --source-resource-group acebial --destination-container acebialrprod --source-disk-name acebialProdOSdisk 

## Copy Data Disk From CentralIndia to SouthIndia DC storage account

az disk copy-to-vhd --account-name acebialrstorage --destination-blob bialprodData.vhd --source-resource-group acebial --destination-container acebialrprod --source-disk-name acebialProdData_disk2 

### Create disk from Blob

az disk create --resource-group acebialr --name acebialProdOSdiskr --sku Premium_LRS --location southindia --size-gb 128 --source https://acebialrstorage.blob.core.windows.net/acebialrprod/bialprodOSdisk.vhd

az disk create --resource-group acebialr --name acebialProdData_disk2r --sku Premium_LRS --location southindia --size-gb 512 --source  https://acebialrstorage.blob.core.windows.net/acebialrprod/bialprodData.vhd


## Run Below Command to create vm in DR DC i.e southindia DC

az vm create --resource-group acebialr --name acebialprod01r --attach-os-disk acebialProdOSdiskr --os-disk-size-gb 128 --os-type linux --attach-data-disks acebialProdData_disk2r --data-disk-sizes-gb 512 --nics acebialprod01rVMNic --size Standard_DS3_v2 --boot-diagnostics-storage acebialrstorage 


## Restart the VM

az vm restart --name acebialprod01r --resource-group acebialr

*************************************************************************

### Create VM and attach OS disk created from backup

az vm create --resource-group acebialr --name acebialprod01r --attach-os-disk acebialProdOSdiskr --os-type linux 

### Attach data disk which is created from backup and reboot the VM

az vm disk attach --vm-name acebialprod01r --resource-group acebialr --sku Premium_LRS --disk  acebialProdData_disk2r --size-gb 512 --caching None

az vm restart --name acebialprod01r --resource-group acebialr

*************************************************************

az vm create --resource-group acebialr --name acebialprod01r --attach-os-disk acebialProdOSdiskr --os-disk-size-gb 128 --os-type linux --attach-data-disks  acebialProdData_disk2r --data-disk-sizes-gb 512  --nics acebialprod01rVMNic --vnet-name acebialdb02RVNET --nsg acebialprod01rNSG --public-ip-address acebialprod01rPublicIP --size Standard_DS3_v2

********************************************************
          Azure VM's Snapshots
********************************************************

az snapshot create -g bial_magento -n atbialOsdisk --source Bial-fe_OsDisk_1_a74aca969d55464095a54c282c5a5b31

az snapshot show --name atbialOsdisk --resource-group bial_magento --output table

az disk create --resource-group bial_magento --name bialfeOSdisk --sku Premium_LRS --size-gb 31 --source "/subscriptions/a4d11e3d-98db-4857-b50e-6813049bbc66/resourceGroups/bial_magento/providers/Microsoft.Compute/snapshots/atbialOsdisk"

az vm create --resource-group atbial --location centralindia --name atbialtestvm --os-type linux --attach-os-disk atbialOsdisk
az vm disk attach --vm-name  atbialtestvm  --resource-group atbial --sku Premium_LRS --disk attestbialvmdisk2  --caching None

Resize the vm and reboot

az image copy --source-resource-group acebial --source-object-name bialcentos74 --target-location  southindia --target-resource-group "acebialR"


az disk copy-to-vhd --account-name southindiaf5oflf1tizmlnn --destination-blob newdisk --source-resource-group acebial --destination-container snapshots --source-disk-name bialProddbOSdisk


az disk create --resource-group acebialr --name disk1 --sku Premium_LRS --location southindia --size-gb 512 --source https://southindiaf5oflf1tizmlnn.blob.core.windows.net/snapshots/newdisk


Copy disk to Destination Blob

az disk copy-to-vhd --account-name southindiaf5oflf1tizmlnn --destination-blob bialdb01data.vhd --source-resource-group acebial --destination-container snapshots --source-disk-name acebialdb01_OsDisk_1_142cf22dd5914348af705d5d494000f8


Create disk from Blob

az disk create --resource-group acebialr --name disk2 --sku Premium_LRS --location southindia --size-gb 512 --source https://southindiaf5oflf1tizmlnn.blob.core.windows.net/snapshots/bialdb01OSdata.vhd

Create VM from disk created using blob
az vm create --resource-group acebialr --name replicat1 --attach-os-disk disk2 --os-type linux


Create Disk from vhd source

az disk create -g acebialr -n newdisk --source https://southindiaf5oflf1tizmlnn.blob.core.windows.net/snapshots/bialdb01OS.vhd




Azure - VMSS
====================================================

The Azure command-line interface (Azure CLI) is a set of commands used to create and manage Azure resources.



Azure Load Balancer - Commands -Useful 



Comments

Popular posts from this blog

RHEL - How to back out a failed patch

Vathsa's- Linux - SysOps and DevOps

Local Yum Repository for Oracle Linux 8