Besides its performance and data management capabilities, Azure NetApp Files gives the users the possibility to automate, simplify and speed up resources provisioning and management through PowerShell, CLI and REST API thanks to its integration with Azure Resource Manager.
This blog helps you get started with using the PowerShell and CLI commands and scripts for Azure NetApp Files to provision and manage resources such as NetApp accounts, capacity pools, volumes and snapshots.
Azure PowerShell
NetApp accounts
Create a NetApp account
New-AzNetAppFilesAccount -ResourceGroupName "MyRG" -Name "MyAnfAccount" -l "MyAnfRegion"
Get details of a NetApp account
Get-AzNetAppFilesAccount -ResourceGroupName "MyRG" -Name "MyAnfAccount"
Delete a NetApp account
Remove-AzNetAppFilesAccount -ResourceGroupName "MyRG" -Name "MyAnfAccount"
Capacity pools
Create a capacity pool
New-AzNetAppFilesPool -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -Name "MyAnfPool" -l "MyAnfRegion" -PoolSize 4398046511104 -ServiceLevel "Premium"
Capacity pool size: in Byte — 1 TiB = 10244 Byte = 1 099 511 627 776 Byte — 4 TiB = 4 398 046 511 104 Byte
Service level: standard, premium, ultra
Get details of a capacity pool
Get-AzNetAppFilesPool -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -Name "MyAnfPool"
Resize a capacity pool
Update-AzNetAppFilesPool -ResourceGroupName "MyRG" -l "MyAnfRegion" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -PoolSize 5497558138880
Resize to 5 TiB: 5 497 558 138 880 Byte
Delete a capacity pool
Remove-AzNetAppFilesPool -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -Name "MyAnfPool"
Volumes
Create a volume
New-AzNetAppFilesVolume -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -Name "MyAnfVolume" -l "MyAnfRegion" -CreationToken "MyAnfVolume" -UsageThreshold 1099511627776 -ServiceLevel "Premium" -ProtocolType CIFS -SubnetId "/subscriptions/subsId/resourceGroups/MyRG/providers/Microsoft.Network/virtualNetworks/MyVnetName/subnets/MySubNetName"
Creation token: file path, a unique mount point within the subscription
Volume size: in Byte — 1 TiB = 10244 Byte = 1 099 511 627 776 Byte
Service level: standard, premium, ultra
Protocol type = CIFS, NFSv3, NFSv4.1
Get details of a volume
Get-AzNetAppFilesVolume -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -Name "MyAnfVolume"
Resize a volume
Update-AzNetAppFilesVolume -ResourceGroupName "MyRG" -l "MyAnfRegion" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -Name "MyAnfVolume" -UsageThreshold 2199023255552
Resize to 2 TiB: 2 199 023 255 552 Byte
Delete a volume
Remove-AzNetAppFilesVolume -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -Name "MyAnfVolume"
Snapshots
Create a snapshot
New-AzNetAppFilesSnapshot -ResourceGroupName "MyRG" -l "MyAnfRegion" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -VolumeName "MyAnfVolume" -SnapshotName "MyAnfSnapshot"
Get details of a snapshot
Get-AzNetAppFilesSnapshot -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -VolumeName "MyAnfVolume" -Name "MyAnfSnapshot"
Delete a snapshot
Remove-AzNetAppFilesSnapshot -ResourceGroupName "MyRG" -AccountName "MyAnfAccount" -PoolName "MyAnfPool" -VolumeName "MyAnfVolume" -Name "MyAnfSnapshot"
Azure CLI
NetApp accounts
List NetApp accounts
az netappfiles account list -g MyRG
az netappfiles account list -g MyRG -o table
Create a NetApp account
az netappfiles account create -g MyRG --name MyAnfAccount -l MyAnfRegion
Get details of a NetApp account
az netappfiles account show -g MyRG
Delete a NetApp account
az netappfiles account delete -g MyRG --name MyAnfAccount
Capacity pools
List capacity pools
az netappfiles pool list -g MyRG -a MyAnfAccount
az netappfiles pool list -g MyRG -a MyAnfAccount -o table
Create a capacity pool
az netappfiles pool create -g MyRG --account-name MyAnfAccount --name MyAnfPool -l MyAnfRegion --size 4 --service-level Premium
Capacity pool size: in TiB
Get details of a capacity pool
az netappfiles pool show -g MyRG --account-name MyAnfAccount --name MyAnfPool
Resize a capacity pool
az netappfiles pool update -g MyRG --account-name MyAnfAccount --name MyAnfPool --size 5
Resize to 5 TiB
Delete a capacity pool
az netappfiles pool delete -g MyRG --account-name MyAnfAccount --name MyAnfPool
Volumes
List volumes of a pool
az netappfiles volume list -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool
az netappfiles volume list -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool -o table
Create a volume
az netappfiles volume create -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --name MyAnfVolume -l MyAnfRegion --service-level Premium --usage-threshold 1024 --file-path MyAnfVolume --vnet "/subscriptions/subsId/resourceGroups/MyRG/providers/Microsoft.Network/virtualNetworks/MyVnetName" --subnet "/subscriptions/subsId/resourceGroups/MyRG/providers/Microsoft.Network/virtualNetworks/MyVnetName/subnets/MySubnetName" --protocol-types CIFS
Volume size: in GiB — 1 TiB = 1024 GiB
File path: a unique mount point within the subscription
Protocol types: CIFS, NFSv3, NFSv4.1
Get details of a volume
az netappfiles volume show -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --name MyAnfVolume
Resize a volume
az netappfiles volume update -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --name MyAnfVolume --usage-threshold 2048
Resize to 2 TiB: 2048 GiB
Delete a volume
az netappfiles volume delete -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --name MyAnfVolume
Snapshots
List snapshots of a volume
az netappfiles snapshot list -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --volume-name MyAnfVolume
az netappfiles snapshot list -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --volume-name MyAnfVolume -o table
Create a snapshot
az netappfiles snapshot create -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --volume-name MyAnfVolume --name MyAnfSnapshot -l MyAnfRegion
Get details of a snapshot
az netappfiles snapshot show -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --volume-name MyAnfVolume --name MyAnfSnapshot
Delete a snapshot
az netappfiles snapshot delete -g MyRG --account-name MyAnfAccount --pool-name MyAnfPool --volume-name MyAnfVolume --name MyAnfSnapshot
Deployment Script
You can find an example of capacity pool and volume deployment script, using the PowerShell commands above, in the following blog: Automate Azure NetApp Files with PowerShell – anfcommunity