text
#list all storage accounts
az storage account list
# [] = collection of multiple storage accounts
# .name filter names only out of collection of multiple storage accounts
az storage account list --query [].name
#Using Azure PowerShell
Connect-AzAccount
Get-Command, Get-Help
Get-Command *azvm* -Module Az.Compute | more
ARM templates are JSON JavaScript Object Notation
###################
PS /home/steffen> $location = (Get-AzResourceGroup -Name rg-az104)
PS /home/steffen> Get-AzResourceGroup -Name rg-az104
ResourceGroupName : rg-az104
Location : ukwest
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-az104
PS /home/steffen> (Get-AzResourceGroup -Name rg-az104).Location
ukwest
PS /home/steffen> $location = (Get-AzResourceGroup -Name rg-az104).Location
PS /home/steffen> (Get-AzResourceGroup -Name rg-az104).ProvisioningState
Succeeded
PS /home/steffen> $rgName = 'rg-az104'
PS /home/steffen> (Get-AzResourceGroup -Name $rgName).ProvisioningState
Succeeded
PS /home/steffen> (Get-AzResourceGroup -Name $rgName).Location
ukwest
PS /home/steffen> $location = (Get-AzResourceGroup -Name rg-az104).Location
PS /home/steffen> printf $location
ukwest
PS /home/steffen> New-AzResourceGroup -Location $location -ResourceGroupName rg-test
ResourceGroupName : rg-test
Location : ukwest
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test
PS /home/steffen> $rgName = 'rg-test'
PS /home/steffen> New-AzResourceGroup -Location $location -ResourceGroupName $rgName
Confirm
Provided resource group already exists. Are you sure you want to update it?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
ResourceGroupName : rg-test
Location : ukwest
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test
PS /home/steffen> Get-AzResourceGroup -Name $rgName
ResourceGroupName : rg-test
Location : ukwest
ProvisioningState : Succeeded
Tags :
ResourceId : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test
PS /home/steffen> $diskConfig = New-AzDiskConfig `
>> -Location $location `
>> -CreateOption Empty `
>> -DiskSizeGB 32 `
>> -Sku Standard_LRS
PS /home/steffen> printf $diskConfig
Microsoft.Azure.Commands.Compute.Automation.Models.PSDisk
PS /home/steffen> $diskName = 'az104-disk1'
PS /home/steffen> New-AzDisk -ResourceGroupName $rgName -DiskName 'az104-disk1' -Disk $diskConfig
WARNING: Upcoming breaking changes in the cmdlet 'New-AzDisk' :
Starting in November 2023 the "New-AzDisk" cmdlet will deploy with the Trusted Launch configuration by default. This includes defaulting the "HyperVGeneration" parameter to "v2". To know more about Trusted Launch, please visit https://learn.microsoft.com/en-us/azure/virtual-machines/trusted-launch
Note : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
ResourceGroupName : rg-test
ManagedBy :
ManagedByExtended : {}
Sku : Microsoft.Azure.Management.Compute.Models.DiskSku
Zones :
TimeCreated : 6/7/2023 7:44:04 AM
OsType :
HyperVGeneration :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 32
DiskSizeBytes : 34359738368
UniqueId : 865658f3-e4f7-4469-942b-3a39909f6245
EncryptionSettingsCollection :
ProvisioningState : Succeeded
DiskIOPSReadWrite : 500
DiskMBpsReadWrite : 60
DiskIOPSReadOnly :
DiskMBpsReadOnly :
DiskState : Unattached
Encryption : Microsoft.Azure.Management.Compute.Models.Encryption
MaxShares :
ShareInfo : {}
Id : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test/providers/Microsoft.Compute/disks/az104-disk1
Name : az104-disk1
Type : Microsoft.Compute/disks
Location : ukwest
ExtendedLocation :
Tags : {}
NetworkAccessPolicy : AllowAll
DiskAccessId :
Tier :
BurstingEnabled :
PurchasePlan :
SupportsHibernation :
SecurityProfile :
PublicNetworkAccess : Enabled
SupportedCapabilities :
DataAccessAuthMode :
CompletionPercent :
PS /home/steffen> New-AzDiskUpdateConfig -DiskSizeGB 64 | Update-AzDisk -ResourceGroupName rg-test -diskname az104-disk1
ResourceGroupName : rg-test
ManagedBy :
ManagedByExtended : {}
Sku : Microsoft.Azure.Management.Compute.Models.DiskSku
Zones :
TimeCreated : 6/7/2023 7:44:04 AM
OsType :
HyperVGeneration :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 64
DiskSizeBytes : 68719476736
UniqueId : 865658f3-e4f7-4469-942b-3a39909f6245
EncryptionSettingsCollection :
ProvisioningState : Succeeded
DiskIOPSReadWrite : 500
DiskMBpsReadWrite : 60
DiskIOPSReadOnly :
DiskMBpsReadOnly :
DiskState : Unattached
Encryption : Microsoft.Azure.Management.Compute.Models.Encryption
MaxShares :
ShareInfo : {}
Id : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test/providers/Microsoft.Compute/disks/az104-disk1
Name : az104-disk1
Type : Microsoft.Compute/disks
Location : ukwest
ExtendedLocation :
Tags : {}
NetworkAccessPolicy : AllowAll
DiskAccessId :
Tier :
BurstingEnabled :
PurchasePlan :
SupportsHibernation :
SecurityProfile :
PublicNetworkAccess : Enabled
SupportedCapabilities :
DataAccessAuthMode :
CompletionPercent :
PS /home/steffen>
PS /home/steffen> (Get-AzDisk -ResourceGroupName rg-test -DiskName az104-disk1).DiskSizeGB
64
PS /home/steffen> (Get-AzDisk -ResourceGroupName rg-test -DiskName az104-disk1).SKu
Name Tier
---- ----
Standard_LRS Standard
PS /home/steffen> New-AzDiskUpdateConfig -SKu Premium_LRS | Update-AzDisk -ResourceGroupName rg-test -diskname az104-disk1
ResourceGroupName : rg-test
ManagedBy :
ManagedByExtended : {}
Sku : Microsoft.Azure.Management.Compute.Models.DiskSku
Zones :
TimeCreated : 6/7/2023 7:44:04 AM
OsType :
HyperVGeneration :
CreationData : Microsoft.Azure.Management.Compute.Models.CreationData
DiskSizeGB : 64
DiskSizeBytes : 68719476736
UniqueId : 865658f3-e4f7-4469-942b-3a39909f6245
EncryptionSettingsCollection :
ProvisioningState : Succeeded
DiskIOPSReadWrite : 240
DiskMBpsReadWrite : 50
DiskIOPSReadOnly :
DiskMBpsReadOnly :
DiskState : Unattached
Encryption : Microsoft.Azure.Management.Compute.Models.Encryption
MaxShares :
ShareInfo : {}
Id : /subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/rg-test/providers/Microsoft.Compute/disks/az104-disk1
Name : az104-disk1
Type : Microsoft.Compute/disks
Location : ukwest
ExtendedLocation :
Tags : {}
NetworkAccessPolicy : AllowAll
DiskAccessId :
Tier : P6
BurstingEnabled :
PurchasePlan :
SupportsHibernation :
SecurityProfile :
PublicNetworkAccess : Enabled
SupportedCapabilities :
DataAccessAuthMode :
CompletionPercent :
PS /home/steffen> (Get-AzDisk -ResourceGroupName rg-test -DiskName az104-disk1).SKu
Name Tier
---- ----
Premium_LRS Premium
PS /home/steffen>
steffen [ ~ ]$ az group show --name 'az-104-03c-rg1-681427' --query location --out tsv
westeurope
steffen [ ~ ]$ az group show --name 'az-104-03c-rg1-681427' --query location
"westeurope"
steffen [ ~ ]$ RGNAME='az-104-03c-rg1-681427'
steffen [ ~ ]$ az group create --name $RGNAME --location $LOCATION
{
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427",
"location": "westeurope",
"managedBy": null,
"name": "az-104-03c-rg1-681427",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
steffen [ ~ ]$ az group show --name $RGNAME
{
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427",
"location": "westeurope",
"managedBy": null,
"name": "az-104-03c-rg1-681427",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null,
"type": "Microsoft.Resources/resourceGroups"
}
steffen [ ~ ]$ az disk create --resource-group $RGNAME --name $DISKNAME --sku 'Standard_LRS' --size-gb 32
{
"burstingEnabled": null,
"burstingEnabledTime": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"performancePlus": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 500,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 60,
"diskSizeBytes": 34359738368,
"diskSizeGb": 32,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427/providers/Microsoft.Compute/disks/az-104-03d-disk1",
"location": "westeurope",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "az-104-03d-disk1",
"networkAccessPolicy": "AllowAll",
"optimizedForFrequentAttach": null,
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "az-104-03c-rg1-681427",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": {},
"tier": null,
"timeCreated": "2023-06-08T07:10:45.776770+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1d7d2e2a-3f58-4825-8977-0309a6c5a88d",
"zones": null
}
steffen [ ~ ]$ az disk show --resource-group $RGNAME --name $DISKNAME
{
"burstingEnabled": null,
"burstingEnabledTime": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"performancePlus": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 500,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 60,
"diskSizeBytes": 34359738368,
"diskSizeGb": 32,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427/providers/Microsoft.Compute/disks/az-104-03d-disk1",
"location": "westeurope",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "az-104-03d-disk1",
"networkAccessPolicy": "AllowAll",
"optimizedForFrequentAttach": null,
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "az-104-03c-rg1-681427",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": {},
"tier": null,
"timeCreated": "2023-06-08T07:10:45.776770+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1d7d2e2a-3f58-4825-8977-0309a6c5a88d",
"zones": null
}
steffen [ ~ ]$ az disk update --resource-group $RGNAME --name $DISKNAME --size-gb 64
{
"burstingEnabled": null,
"burstingEnabledTime": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"performancePlus": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 500,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 60,
"diskSizeBytes": 68719476736,
"diskSizeGb": 64,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427/providers/Microsoft.Compute/disks/az-104-03d-disk1",
"location": "westeurope",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "az-104-03d-disk1",
"networkAccessPolicy": "AllowAll",
"optimizedForFrequentAttach": null,
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "az-104-03c-rg1-681427",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": {},
"tier": null,
"timeCreated": "2023-06-08T07:10:45.776770+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1d7d2e2a-3f58-4825-8977-0309a6c5a88d",
"zones": null
}
steffen [ ~ ]$ az disk show --resource-group $RGNAME --name $DISKNAME
{
"burstingEnabled": null,
"burstingEnabledTime": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"performancePlus": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 500,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 60,
"diskSizeBytes": 68719476736,
"diskSizeGb": 64,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427/providers/Microsoft.Compute/disks/az-104-03d-disk1",
"location": "westeurope",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "az-104-03d-disk1",
"networkAccessPolicy": "AllowAll",
"optimizedForFrequentAttach": null,
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "az-104-03c-rg1-681427",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": {},
"tier": null,
"timeCreated": "2023-06-08T07:10:45.776770+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1d7d2e2a-3f58-4825-8977-0309a6c5a88d",
"zones": null
}
steffen [ ~ ]$ az disk show --resource-group $RGNAME --name $DISKNAME --query diskSizeGb
64
steffen [ ~ ]$ az disk update --resource-group $RGNAME --name $DISKNAME --sku 'Premium_LRS'
{
"burstingEnabled": null,
"burstingEnabledTime": null,
"completionPercent": null,
"creationData": {
"createOption": "Empty",
"galleryImageReference": null,
"imageReference": null,
"logicalSectorSize": null,
"performancePlus": null,
"securityDataUri": null,
"sourceResourceId": null,
"sourceUniqueId": null,
"sourceUri": null,
"storageAccountId": null,
"uploadSizeBytes": null
},
"dataAccessAuthMode": null,
"diskAccessId": null,
"diskIopsReadOnly": null,
"diskIopsReadWrite": 240,
"diskMBpsReadOnly": null,
"diskMBpsReadWrite": 50,
"diskSizeBytes": 68719476736,
"diskSizeGb": 64,
"diskState": "Unattached",
"encryption": {
"diskEncryptionSetId": null,
"type": "EncryptionAtRestWithPlatformKey"
},
"encryptionSettingsCollection": null,
"extendedLocation": null,
"hyperVGeneration": "V1",
"id": "/subscriptions/53a7a158-7fdc-4c43-bd4c-69a17e1dc5e6/resourceGroups/az-104-03c-rg1-681427/providers/Microsoft.Compute/disks/az-104-03d-disk1",
"location": "westeurope",
"managedBy": null,
"managedByExtended": null,
"maxShares": null,
"name": "az-104-03d-disk1",
"networkAccessPolicy": "AllowAll",
"optimizedForFrequentAttach": null,
"osType": null,
"propertyUpdatesInProgress": null,
"provisioningState": "Succeeded",
"publicNetworkAccess": "Enabled",
"purchasePlan": null,
"resourceGroup": "az-104-03c-rg1-681427",
"securityProfile": null,
"shareInfo": null,
"sku": {
"name": "Premium_LRS",
"tier": "Premium"
},
"supportedCapabilities": null,
"supportsHibernation": null,
"tags": {},
"tier": "P6",
"timeCreated": "2023-06-08T07:10:45.776770+00:00",
"type": "Microsoft.Compute/disks",
"uniqueId": "1d7d2e2a-3f58-4825-8977-0309a6c5a88d",
"zones": null
}
steffen [ ~ ]$ az disk show --resource-group $RGNAME --name $DISKNAME --query sku
{
"name": "Premium_LRS",
"tier": "Premium"
}