Skip to content

Files

Latest commit

7e303ca · Mar 18, 2022

History

History
462 lines (307 loc) · 19.1 KB

azure-netapp-files-quickstart-set-up-account-create-volumes.md

File metadata and controls

462 lines (307 loc) · 19.1 KB
title description author ms.author ms.service ms.workload ms.topic ms.date ms.custom
Quickstart: Set up Azure NetApp Files and NFS volume
Quickstart - Describes how to quickly set up Azure NetApp Files and create a volume.
b-hchen
anfdocs
azure-netapp-files
storage
quickstart
10/04/2021
devx-track-azurecli, subject-armqs, mode-ui

Quickstart: Set up Azure NetApp Files and create an NFS volume

This article shows you how to quickly set up Azure NetApp Files and create an NFS volume.

In this quickstart, you will set up the following items:

  • Registration for NetApp Resource Provider
  • A NetApp account
  • A capacity pool
  • An NFS volume for Azure NetApp Files

If you don't have an Azure subscription, create a free account before you begin.

To see all features that you can enable for an NFS volume and relevant considerations, see Create an NFS volume.

Register for NetApp Resource Provider

Note

The registration process can take some time to complete.

For registration steps using Portal, open a Cloud Shell session as indicated above and follow these Azure CLI steps:

[!INCLUDE azure-netapp-files-cloudshell-include]

This how-to article requires the Azure PowerShell module Az version 2.6.0 or later. Run Get-Module -ListAvailable Az to find your current version. If you need to install or upgrade, see Install Azure PowerShell module. If you prefer, you can use Cloud Shell console in a PowerShell session instead.

  1. In a PowerShell command prompt (or PowerShell Cloud Shell session), specify the subscription that has been approved for Azure NetApp Files:

    Select-AzSubscription -Subscription <subscriptionId>
    
  2. Register the Azure Resource Provider:

    Register-AzResourceProvider -ProviderNamespace Microsoft.NetApp
    

Prepare your environment for the Azure CLI.

[!INCLUDE azure-cli-prepare-your-environment-no-header.md]

[!INCLUDE azure-netapp-files-cloudshell-include]

None.

Use the Azure portal, PowerShell, or the Azure CLI to register for NetApp Resource Provider.


Create a NetApp account

  1. In the Azure portal's search box, enter Azure NetApp Files and then select Azure NetApp Files from the list that appears.

    Select Azure NetApp Files

  2. Click + Create to create a new NetApp account.

  3. In the New NetApp Account window, provide the following information:

    1. Enter myaccount1 for the account name.

    2. Select your subscription.

    3. Select Create new to create new resource group. Enter myRG1 for the resource group name. Click OK.

    4. Select your account location.

      New NetApp Account window

      Resource group window

  4. Click Create to create your new NetApp account.

  1. Define some variables so we can refer to them throughout the rest of the examples:

    $resourceGroup = "myRG1"
    $location = "eastus"
    $anfAccountName = "myaccount1"
    

    [!NOTE] Please refer to Products available by region for a list of supported regions. To obtain the region name that is supported by our command line tools, please use Get-AzLocation | select Location

  2. Create a new resource group by using the New-AzResourceGroup command:

    New-AzResourceGroup -Name $resourceGroup -Location $location
    
  3. Create Azure NetApp Files account with New-AzNetAppFilesAccount command:

    New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $location -Name $anfAccountName
    
  1. Define some variables so we can refer to them throughout the rest of the examples:

    RESOURCE_GROUP="myRG1"
    LOCATION="eastus"
    ANF_ACCOUNT_NAME="myaccount1"
    

    [!NOTE] Please refer to Products available by region for a list of supported regions. To obtain the region name that is supported by our command line tools, please use az account list-locations --query "[].{Region:name}" --out table

  2. Create a new resource group by using the az group create command:

    az group create \
        --name $RESOURCE_GROUP \
        --location $LOCATION
    
  3. Create Azure NetApp Files account with az netappfiles account create command:

    az netappfiles account create \
        --resource-group $RESOURCE_GROUP \
        --location $LOCATION \
        --account-name $ANF_ACCOUNT_NAME
    

[!INCLUDE About Azure Resource Manager]

The following code snippet shows how to create a NetApp account in an Azure Resource Manager template (ARM template), using the Microsoft.NetApp/netAppAccounts resource. To run the code, download the full ARM template from our GitHub repo.

:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.netapp/anf-nfs-volume/azuredeploy.json" range="177-183":::


Create a capacity pool

  1. From the Azure NetApp Files management blade, select your NetApp account (myaccount1).

    Select NetApp account

  2. From the Azure NetApp Files management blade of your NetApp account, click Capacity pools.

    Click Capacity pools

  3. Click + Add pools.

    Click Add pools

  4. Provide information for the capacity pool:

    • Enter mypool1 as the pool name.
    • Select Premium for the service level.
    • Specify 4 (TiB) as the pool size.
    • Use the Auto QoS type.
  5. Click Create.

  1. Defining some new variables for future reference

    $poolName = "mypool1"
    $poolSizeBytes = 4398046511104 # 4TiB
    $serviceLevel = "Premium" # Valid values are Standard, Premium and Ultra
    
  2. Create a new capacity pool by using the New-AzNetAppFilesPool

    New-AzNetAppFilesPool -ResourceGroupName $resourceGroup -Location $location -AccountName $anfAccountName -Name $poolName -PoolSize $poolSizeBytes -ServiceLevel $serviceLevel
    
  1. Defining some new variables for future reference

    POOL_NAME="mypool1"
    POOL_SIZE_TiB=4 # Size in Azure CLI needs to be in TiB unit (minimum 4 TiB)
    SERVICE_LEVEL="Premium" # Valid values are Standard, Premium and Ultra
    
  2. Create a new capacity pool by using the az netappfiles pool create

    az netappfiles pool create \
        --resource-group $RESOURCE_GROUP \
        --location $LOCATION \
        --account-name $ANF_ACCOUNT_NAME \
        --pool-name $POOL_NAME \
        --size $POOL_SIZE_TiB \
        --service-level $SERVICE_LEVEL
    

The following code snippet shows how to create a capacity pool in an Azure Resource Manager template (ARM template), using the Microsoft.NetApp/netAppAccounts/capacityPools resource. To run the code, download the full ARM template from our GitHub repo.

:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.netapp/anf-nfs-volume/azuredeploy.json" range="184-196":::


Create an NFS volume for Azure NetApp Files

  1. From the Azure NetApp Files management blade of your NetApp account, click Volumes.

    Click Volumes

  2. Click + Add volume.

    Click Add volumes

  3. In the Create a Volume window, provide information for the volume:

    1. Enter myvol1 as the volume name.

    2. Select your capacity pool (mypool1).

    3. Use the default value for quota.

    4. Under virtual network, click Create new to create a new Azure virtual network (Vnet). Then fill in the following information:

      • Enter myvnet1 as the Vnet name.
      • Specify an address space for your setting, for example, 10.7.0.0/16
      • Enter myANFsubnet as the subnet name.
      • Specify the subnet address range, for example, 10.7.0.0/24. You cannot share the dedicated subnet with other resources.
      • Select Microsoft.NetApp/volumes for subnet delegation.
      • Click OK to create the Vnet.
    5. In subnet, select the newly created Vnet (myvnet1) as the delegate subnet.

      Create a volume window

      Create virtual network window

  4. Click Protocol, and then complete the following actions:

    • Select NFS as the protocol type for the volume.
    • Enter myfilepath1 as the file path that will be used to create the export path for the volume.
    • Select the NFS version (NFSv3 or NFSv4.1) for the volume. See considerations and best practice about NFS versions.

    Specify NFS protocol for quickstart

  5. Click Review + create to display information for the volume you are creating.

  6. Click Create to create the volume. The created volume appears in the Volumes blade.

    Volume created

  1. Create a subnet delegation to "Microsoft.NetApp/volumes" with New-AzDelegation command.

    $anfDelegation = New-AzDelegation -Name ([guid]::NewGuid().Guid) -ServiceName "Microsoft.NetApp/volumes"
    
  2. Create a subnet configuration by using New-AzVirtualNetworkSubnetConfig command.

    $subnet = New-AzVirtualNetworkSubnetConfig -Name "myANFSubnet" -AddressPrefix "10.7.0.0/24" -Delegation $anfDelegation
    
  3. Create the virtual network by using the New-AzVirtualNetwork command.

    $vnet = New-AzVirtualNetwork -Name "myvnet1" -ResourceGroupName $resourceGroup -Location $location -AddressPrefix "10.7.0.0/16" -Subnet $subnet
    
  4. Create the volume by using the New-AzNetAppFilesVolume command.

    $volumeSizeBytes = 1099511627776 # 100GiB
    $subnetId = $vnet.Subnets[0].Id
    
    New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup `
        -Location $location `
        -AccountName $anfAccountName `
        -PoolName $poolName `
        -Name "myvol1" `
        -UsageThreshold $volumeSizeBytes `
        -SubnetId $subnetId `
        -CreationToken "myfilepath1" `
        -ServiceLevel $serviceLevel `
        -ProtocolType NFSv3
    
  1. Defining some variables for later usage.

    VNET_NAME="myvnet1"
    SUBNET_NAME="myANFSubnet"
    
  2. Create virtual network without subnet by using the az network vnet create command.

    az network vnet create \
        --resource-group $RESOURCE_GROUP \
        --name $VNET_NAME \
        --location $LOCATION \
        --address-prefix "10.7.0.0/16"
    
    
  3. Create a delegated subnet by using az network vnet subnet create command.

    az network vnet subnet create \
        --resource-group $RESOURCE_GROUP \
        --vnet-name $VNET_NAME \
        --name $SUBNET_NAME \
        --address-prefixes "10.7.0.0/24" \
        --delegations "Microsoft.NetApp/volumes"
    
  4. Create the volume by using the az netappfiles volume create command.

    VNET_ID=$(az network vnet show --resource-group $RESOURCE_GROUP --name $VNET_NAME --query "id" -o tsv)
    SUBNET_ID=$(az network vnet subnet show --resource-group $RESOURCE_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME --query "id" -o tsv)
    VOLUME_SIZE_GiB=100 # 100 GiB
    UNIQUE_FILE_PATH="myfilepath2" # Please note that creation token needs to be unique within subscription and region
    
    az netappfiles volume create \
        --resource-group $RESOURCE_GROUP \
        --location $LOCATION \
        --account-name $ANF_ACCOUNT_NAME \
        --pool-name $POOL_NAME \
        --name "myvol1" \
        --service-level $SERVICE_LEVEL \
        --vnet $VNET_ID \
        --subnet $SUBNET_ID \
        --usage-threshold $VOLUME_SIZE_GiB \
        --file-path $UNIQUE_FILE_PATH \
        --protocol-types "NFSv3"
    

The following code snippets show how to set up a VNet and create an Azure NetApp Files volume in an Azure Resource Manager template (ARM template). VNet setup uses the Microsoft.Network/virtualNetworks resource. Volume creation uses the Microsoft.NetApp/netAppAccounts/capacityPools/volumes resource. To run the code, download the full ARM template from our GitHub repo.

:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.netapp/anf-nfs-volume/azuredeploy.json" range="148-176":::

:::code language="json" source="~/quickstart-templates/quickstarts/microsoft.netapp/anf-nfs-volume/azuredeploy.json" range="197-229":::


Clean up resources

When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.

Important

All resources within the resource groups will be permanently deleted and cannot be undone.

  1. In the Azure portal's search box, enter Azure NetApp Files and then select Azure NetApp Files from the list that appears.

  2. In the list of subscriptions, click the resource group (myRG1) you want to delete.

    Navigate to resource groups

  3. In the resource group page, click Delete resource group.

    Screenshot that highlights the Delete resource group button.

    A window opens and displays a warning about the resources that will be deleted with the resource group.

  4. Enter the name of the resource group (myRG1) to confirm that you want to permanently delete the resource group and all resources in it, and then click Delete.

    Confirm deleting resource group

When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.

Important

All resources within the resource groups will be permanently deleted and cannot be undone.

  1. Delete resource group by using the Remove-AzResourceGroup command.

    Remove-AzResourceGroup -Name $resourceGroup
    

When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.

Important

All resources within the resource groups will be permanently deleted and cannot be undone.

  1. Delete resource group by using the az group delete command.

    az group delete \
        --name $RESOURCE_GROUP
    

None.

Use the Azure portal, PowerShell, or the Azure CLI to delete the resource group.


Next steps

[!div class="nextstepaction"] Storage hierarchy of Azure NetApp Files

[!div class="nextstepaction"] Service levels for Azure NetApp Files

[!div class="nextstepaction"] Create an NFS volume

[!div class="nextstepaction"] Solution architectures using Azure NetApp Files