Skip to content

Commit a185046

Browse files
authored
Merge pull request #88129 from paulomarquesc/pmarques/commandline
Included PS and CLI commands + typo fix for python
2 parents 604bff9 + e5f8092 commit a185046

File tree

3 files changed

+289
-17
lines changed

3 files changed

+289
-17
lines changed

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

Lines changed: 265 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.workload: storage
1313
ms.tgt_pltfrm: na
1414
ms.devlang: na
1515
ms.topic: quickstart
16-
ms.date: 4/16/2019
16+
ms.date: 9/11/2019
1717
ms.author: b-juche
1818
#Customer intent: As an IT admin new to Azure NetApp Files, I want to quickly set up Azure NetApp Files and create a volume.
1919
---
@@ -35,24 +35,46 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
3535
> [!IMPORTANT]
3636
> You need to be granted access to the Azure NetApp Files service. To request access to the service, see the [Azure NetApp Files waitlist submission page](https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR8cq17Xv9yVBtRCSlcD_gdVUNUpUWEpLNERIM1NOVzA5MzczQ0dQR1ZTSS4u). You must wait for an official confirmation email from the Azure NetApp Files team before continuing.
3737
38+
[!INCLUDE [cloud-shell-try-it.md](../../includes/cloud-shell-try-it.md)]
39+
40+
---
41+
3842
## Register for Azure NetApp Files and NetApp Resource Provider
3943

40-
1. From the Azure portal, click the Azure Cloud Shell icon on the upper right-hand corner.
44+
> [!NOTE]
45+
> The registration process can take some time to complete.
46+
>
4147
42-
![Azure Cloud Shell icon](../media/azure-netapp-files/azure-netapp-files-azure-cloud-shell-window.png)
48+
# [Portal](#tab/azure-portal)
4349

44-
2. Specify the subscription that has been whitelisted for Azure NetApp Files:
45-
46-
az account set --subscription <subscriptionId>
50+
For registration steps using Portal, open a Cloud Shell session as indicated above and follow these Azure CLI steps:
4751

48-
3. Register the Azure Resource Provider:
49-
50-
az provider register --namespace Microsoft.NetApp --wait
52+
[!INCLUDE [azure-netapp-files-cloudshell-include](../../includes/azure-netapp-files-azure-cloud-shell-window.md)]
53+
54+
# [PowerShell](#tab/azure-powershell)
55+
56+
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](/powershell/azure/install-Az-ps). If you prefer, you can use Cloud Shell console in a PowerShell session instead.
57+
58+
1. In a PowerShell command prompt (or PowerShell Cloud Shell session), specify the subscription that has been whitelisted for Azure NetApp Files:
59+
```powershell-interactive
60+
Select-AzSubscription -Subscription <subscriptionId>
61+
```
62+
63+
2. Register the Azure Resource Provider:
64+
```powershell-interactive
65+
Register-AzResourceProvider -ProviderNamespace Microsoft.NetApp
66+
```
5167
52-
The registration process can take some time to complete.
68+
# [Azure CLI](#tab/azure-cli)
69+
70+
[!INCLUDE [azure-netapp-files-cloudshell-include](../../includes/azure-netapp-files-azure-cloud-shell-window.md)]
71+
72+
---
5373
5474
## Create a NetApp account
5575
76+
# [Portal](#tab/azure-portal)
77+
5678
1. In the Azure portal’s search box, enter **Azure NetApp Files** and then select **Azure NetApp Files** from the list that appears.
5779
5880
![Select Azure NetApp Files](../media/azure-netapp-files/azure-netapp-files-select-azure-netapp-files.png)
@@ -73,8 +95,70 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
7395
7496
4. Click **Create** to create your new NetApp account.
7597
98+
# [PowerShell](#tab/azure-powershell)
99+
100+
1. Define some variables so we can refer to them throughout the rest of the examples:
101+
102+
```powershell-interactive
103+
$resourceGroup = "myRG1"
104+
$location = "eastus"
105+
$anfAccountName = "myaccount1"
106+
```
107+
108+
> [!NOTE]
109+
> Please refer to [Products available by region](https://azure.microsoft.com/en-us/global-infrastructure/services/?products=netapp&regions=all) for a list of supported regions.
110+
> To obtain the region name that is supported by our command line tools, please use `Get-AzLocation | select Location`
111+
>
112+
113+
1. Create a new resource group by using the [New-AzResourceGroup](/powershell/module/az.resources/new-azresourcegroup) command:
114+
115+
```powershell-interactive
116+
New-AzResourceGroup -Name $resourceGroup -Location $location
117+
```
118+
119+
2. Create Azure NetApp Files account with [New-AzNetAppFilesAccount](/powershell/module/az.netappfiles/New-AzNetAppFilesAccount) command:
120+
121+
```powershell-interactive
122+
New-AzNetAppFilesAccount -ResourceGroupName $resourceGroup -Location $location -Name $anfAccountName
123+
```
124+
125+
# [Azure CLI](#tab/azure-cli)
126+
127+
1. Define some variables so we can refer to them throughout the rest of the examples:
128+
129+
```azurecli-interactive
130+
RESOURCE_GROUP="myRG1"
131+
LOCATION="eastus"
132+
ANF_ACCOUNT_NAME="myaccount1"
133+
```
134+
135+
> [!NOTE]
136+
> Please refer to [Products available by region](https://azure.microsoft.com/en-us/global-infrastructure/services/?products=netapp&regions=all) for a list of supported regions.
137+
> To obtain the region name that is supported by our command line tools, please use `az account list-locations -query "[].{Region:name}" --out table`
138+
>
139+
140+
2. Create a new resource group by using the [az group create](/cli/azure/group#az-group-create) command:
141+
142+
```azurecli-interactive
143+
az group create \
144+
--name $RESOURCE_GROUP \
145+
--location $LOCATION
146+
```
147+
148+
3. Create Azure NetApp Files account with [az netappfiles account create](/cli/azure/netappfiles/account#az-netappfiles-account-create) command:
149+
150+
```azurecli-interactive
151+
az netappfiles account create \
152+
--resource-group $RESOURCE_GROUP \
153+
--location $LOCATION \
154+
--account-name $ANF_ACCOUNT_NAME
155+
```
156+
---
157+
76158
## Set up a capacity pool
77159
160+
# [Portal](#tab/azure-portal)
161+
78162
1. From the Azure NetApp Files management blade, select your NetApp account (**myaccount1**).
79163
80164
![Select NetApp account](../media/azure-netapp-files/azure-netapp-files-select-netapp-account.png)
@@ -94,7 +178,49 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
94178
95179
5. Click **OK**.
96180
97-
## Create an NFS volume for Azure NetApp Files
181+
# [PowerShell](#tab/azure-powershell)
182+
183+
1. Defining some new variables for future reference
184+
185+
```powershell-interactive
186+
$poolName = "mypool1"
187+
$poolSizeBytes = 4398046511104 # 4TiB
188+
$serviceLevel = "Premium" # Valid values are Standard, Premium and Ultra
189+
```
190+
191+
1. Create a new capacity pool by using the [New-AzNetAppFilesPool](/powershell/module/az.netappfiles/new-aznetappfilespool)
192+
193+
```powershell-interactive
194+
New-AzNetAppFilesPool -ResourceGroupName $resourceGroup -Location $location -AccountName $anfAccountName -Name $poolName -PoolSize $poolSizeBytes -ServiceLevel $serviceLevel
195+
```
196+
197+
# [Azure CLI](#tab/azure-cli)
198+
199+
1. Defining some new variables for future reference
200+
201+
```azurecli-interactive
202+
POOL_NAME="mypool1"
203+
POOL_SIZE_TiB=4 # Size in Azure CLI needs to be in TiB unit (minimum 4 TiB)
204+
SERVICE_LEVEL="Premium" # Valid values are Standard, Premium and Ultra
205+
```
206+
207+
2. Create a new capacity pool by using the [az netappfiles pool create](/cli/azure/netappfiles/pool#az-netappfiles-pool-create)
208+
209+
```azurecli-interactive
210+
az netappfiles pool create \
211+
--resource-group $RESOURCE_GROUP \
212+
--location $LOCATION \
213+
--account-name $ANF_ACCOUNT_NAME \
214+
--pool-name $POOL_NAME \
215+
--size $POOL_SIZE_TiB \
216+
--service-level $SERVICE_LEVEL
217+
```
218+
219+
---
220+
221+
## Create NFS volume for Azure NetApp Files
222+
223+
# [Portal](#tab/azure-portal)
98224
99225
1. From the Azure NetApp Files management blade of your NetApp account, click **Volumes**.
100226
@@ -106,16 +232,16 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
106232
107233
3. In the Create a Volume window, provide information for the volume:
108234
1. Enter **myvol1** as the volume name.
109-
3. Select your capacity pool (**mypool1**).
110-
4. Use the default value for quota.
111-
5. Under virtual network, click **Create new** to create a new Azure virtual network (Vnet). Then fill in the following information:
235+
2. Select your capacity pool (**mypool1**).
236+
3. Use the default value for quota.
237+
4. Under virtual network, click **Create new** to create a new Azure virtual network (Vnet). Then fill in the following information:
112238
* Enter **myvnet1** as the Vnet name.
113239
* Specify an address space for your setting, for example, 10.7.0.0/16
114240
* Enter **myANFsubnet** as the subnet name.
115241
* Specify the subnet address range, for example, 10.7.0.0/24. Note that you cannot share the dedicated subnet with other resources.
116242
* Select **Microsoft.NetApp/volumes** for subnet delegation.
117243
* Click **OK** to create the Vnet.
118-
6. In subnet, select the newly created Vnet (**myvnet1**) as the delegate subnet.
244+
5. In subnet, select the newly created Vnet (**myvnet1**) as the delegate subnet.
119245
120246
![Create a volume window](../media/azure-netapp-files/azure-netapp-files-create-volume-window.png)
121247
@@ -131,13 +257,108 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
131257
132258
![Review and create window](../media/azure-netapp-files/azure-netapp-files-review-and-create-window.png)
133259
134-
5. Review information for the volume, then click **Create**.
260+
6. Review information for the volume, then click **Create**.
135261
The created volume appears in the Volumes blade.
136262
137263
![Volume created](../media/azure-netapp-files/azure-netapp-files-create-volume-created.png)
138264
265+
# [PowerShell](#tab/azure-powershell)
266+
267+
1. Create a subnet delegation to "Microsoft.NetApp/volumes" with [New-AzDelegation](/powershell/module/az.network/new-azdelegation) command.
268+
269+
```powershell-interactive
270+
$anfDelegation = New-AzDelegation -Name ([guid]::NewGuid().Guid) -ServiceName "Microsoft.NetApp/volumes"
271+
```
272+
273+
2. Create a subnet configuration by using [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig) command.
274+
275+
```powershell-interactive
276+
$subnet = New-AzVirtualNetworkSubnetConfig -Name "myANFSubnet" -AddressPrefix "10.7.0.0/24" -Delegation $anfDelegation
277+
```
278+
279+
3. Create the virtual network by using the [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork) command.
280+
281+
```powershell-interactive
282+
$vnet = New-AzVirtualNetwork -Name "myvnet1" -ResourceGroupName $resourceGroup -Location $location -AddressPrefix "10.7.0.0/16" -Subnet $subnet
283+
```
284+
285+
4. Create the volume by using the [New-AzNetAppFilesVolume](/powershell/module/az.netappfiles/new-aznetappfilesvolume) command.
286+
287+
```powershell-interactive
288+
$volumeSizeBytes = 1099511627776 # 100GiB
289+
$subnetId = $vnet.Subnets[0].Id
290+
291+
New-AzNetAppFilesVolume -ResourceGroupName $resourceGroup `
292+
-Location $location `
293+
-AccountName $anfAccountName `
294+
-PoolName $poolName `
295+
-Name "myvol1" `
296+
-UsageThreshold $volumeSizeBytes `
297+
-SubnetId $subnetId `
298+
-CreationToken "myfilepath1" `
299+
-ServiceLevel $serviceLevel `
300+
-ProtocolType NFSv3
301+
```
302+
303+
# [Azure CLI](#tab/azure-cli)
304+
305+
1. Defining some variables for later usage.
306+
307+
```azurecli-interactive
308+
VNET_NAME="myvnet1"
309+
SUBNET_NAME="myANFSubnet"
310+
```
311+
312+
1. Create virtual network without subnet by using the [az network vnet create](/cli/azure/network/vnet#az-network-vnet-create) command.
313+
314+
```azurecli-interactive
315+
az network vnet create \
316+
--resource-group $RESOURCE_GROUP \
317+
--name $VNET_NAME \
318+
--location $LOCATION \
319+
--address-prefix "10.7.0.0/16"
320+
321+
```
322+
323+
2. Create a delegated subnet by using [az network vnet subnet create](/cli/azure/network/vnet/subnet#az-network-vnet-subnet-create) command.
324+
325+
```azurecli-interactive
326+
az network vnet subnet create \
327+
--resource-group $RESOURCE_GROUP \
328+
--vnet-name $VNET_NAME \
329+
--name $SUBNET_NAME \
330+
--address-prefixes "10.7.0.0/24" \
331+
--delegations "Microsoft.NetApp/volumes"
332+
```
333+
334+
3. Create the volume by using the [az netappfiles volume create](/cli/azure/netappfiles/volume#az-netappfiles-volume-create) command.
335+
336+
```azurecli-interactive
337+
VNET_ID=$(az network vnet show --resource-group $RESOURCE_GROUP --name $VNET_NAME --query "id" -o tsv)
338+
SUBNET_ID=$(az network vnet subnet show --resource-group $RESOURCE_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME --query "id" -o tsv)
339+
VOLUME_SIZE_GiB=100 # 100 GiB
340+
UNIQUE_FILE_PATH="myfilepath2" # Please note that creation token needs to be unique within all ANF Accounts
341+
342+
az netappfiles volume create \
343+
--resource-group $RESOURCE_GROUP \
344+
--location $LOCATION \
345+
--account-name $ANF_ACCOUNT_NAME \
346+
--pool-name $POOL_NAME \
347+
--name "myvol1" \
348+
--service-level $SERVICE_LEVEL \
349+
--vnet $VNET_ID \
350+
--subnet $SUBNET_ID \
351+
--usage-threshold $VOLUME_SIZE_GiB \
352+
--creation-token $UNIQUE_FILE_PATH \
353+
--protocol-types "NFSv3"
354+
```
355+
356+
---
357+
139358
## Clean up resources
140359
360+
# [Portal](#tab/azure-portal)
361+
141362
When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.
142363
143364
> [!IMPORTANT]
@@ -160,6 +381,34 @@ When you are done and if you want to, you can delete the resource group. The act
160381
161382
![Delete resource group](../media/azure-netapp-files/azure-netapp-files-azure-confirm-resource-group-deletion.png )
162383
384+
# [PowerShell](#tab/azure-powershell)
385+
386+
When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.
387+
388+
> [!IMPORTANT]
389+
> All resources within the resource groups will be permanently deleted and cannot be undone.
390+
391+
1. Delete resource group by using the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command.
392+
393+
```powershell-interactive
394+
Remove-AzResourceGroup -Name $resourceGroup
395+
```
396+
397+
# [Azure CLI](#tab/azure-cli)
398+
399+
When you are done and if you want to, you can delete the resource group. The action of deleting a resource group is irreversible.
400+
401+
> [!IMPORTANT]
402+
> All resources within the resource groups will be permanently deleted and cannot be undone.
403+
404+
1. Delete resource group by using the [az group delete](/cli/azure/group#az-group-delete) command.
405+
406+
```azurecli-interactive
407+
az group delete \
408+
--name $RESOURCE_GROUP
409+
```
410+
---
411+
163412
## Next steps
164413
165414
> [!div class="nextstepaction"]

articles/azure-netapp-files/azure-netapp-files-sdk-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The table below lists code samples for your reference.
4949
| Language/Tool | Code sample documentation |
5050
|------------------|--------------------------------------------|
5151
| .NET | [Azure NetApp Files SDK sample for .NETCore](https://docs.microsoft.com/samples/azure-samples/netappfiles-dotnetcore-sdk-sample/azure-netappfiles-sdk-sample-for-netcore/) |
52-
| Pythons | [Azure NetApp Files SDK sample for Python](https://docs.microsoft.com/samples/azure-samples/netappfiles-python-sdk-sample/azure-netappfiles-sdk-sample-for-python/) |
52+
| Python | [Azure NetApp Files SDK sample for Python](https://docs.microsoft.com/samples/azure-samples/netappfiles-python-sdk-sample/azure-netappfiles-sdk-sample-for-python/) |
5353

5454
## Next steps
5555
[Download Azure SDKs](https://azure.microsoft.com/downloads/)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: include file
3+
description: include file
4+
services: azure-netapp-files
5+
author: b-juche
6+
ms.service: azure-netapp-files
7+
ms.topic: include
8+
ms.date: 09/10/2019
9+
ms.author: b-juche
10+
ms.custom: include file
11+
---
12+
13+
1. Specify the subscription that has been whitelisted for Azure NetApp Files:
14+
15+
```azurecli-interactive
16+
az account set --subscription <subscriptionId>
17+
```
18+
19+
1. Register the Azure Resource Provider:
20+
21+
```azurecli-interactive
22+
az provider register --namespace Microsoft.NetApp --wait
23+
```

0 commit comments

Comments
 (0)