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.
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressPrefix')]"
]
},
"subnets": [
{
"name": "[parameters('subnetName')]",
"properties": {
"addressPrefix": "[parameters('subnetAddressPrefix')]",
"delegations": [
{
"name": "NetAppDelegation",
"properties": {
"serviceName": "Microsoft.NetApp/volumes"
}
}
]
}
}
]
}
},
{
"type": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes",
"apiVersion": "2020-06-01",
"name": "[variables('volumeName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.NetApp/netAppAccounts/capacityPools', parameters('netAppAccountName'), parameters('netAppPoolName'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
],
"properties": {
"serviceLevel": "[parameters('serviceLevel')]",
"creationToken": "[parameters('netAppVolumeName')]",
"usageThreshold": "[parameters('volSizeBytes')]",
"exportPolicy": {
"rules": [
{
"ruleIndex": 1,
"unixReadOnly": "[parameters('unixReadOnly')]",
"unixReadWrite": "[parameters('unixReadWrite')]",
"cifs": false,
"nfsv3": "[if(equals( parameters('protocolTypes'), 'NFSv3'),bool('true'),bool('false'))]",
"nfsv41": "[if(equals(parameters('protocolTypes'), 'NFSv4.1'),bool('true'),bool('false'))]",
"allowedClients": "[parameters('allowedClients')]"
}
]
},
"protocolTypes": [
"[parameters('protocolTypes')]"
],
"subnetId": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), parameters('subnetName'))]",
"snapshotDirectoryVisible": "[parameters('snapshotDirectoryVisible')]"
}
}