1

I'm looking for a way to set the quota size (ex, 100gb) for the file share I am deploying using Azure ARM Templates. As of now when I deploy it defaults to 5TB which is not ideal. Ideally I would just add a setting to my template.json or parameter.json files that would adjust this setting but I haven't come across anything yet. I'd appreciate any help/guidance on this.


{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "string"
        },
        "storageAccountName": {
            "type": "string"
        },
        "fileShareName": {
            "type": "string",
            "minLength": 3,
            "maxLength": 63
        },
        "fileShareName1": {
            "type": "string",
            "minLength": 3,
            "maxLength": 63
        },
        "fileShareName2": {
            "type": "string",
            "minLength": 3,
            "maxLength": 63
        },
        "accountType": {
            "type": "string"
        },
        "kind": {
            "type": "string"
        },        
        "accessTier": {
            "type": "string"
        },
        "supportsHttpsTrafficOnly": {
            "type": "bool"
        }
    },
    "variables": {},
    "resources": [
        {
            "name": "[parameters('storageAccountName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2018-02-01",
            "location": "[parameters('location')]",
            "properties": {
                "accessTier": "[parameters('accessTier')]",
                "supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]"
            },
            "dependsOn": [],
            "sku": {
                "name": "[parameters('accountType')]"
            },
            "kind": "[parameters('kind')]",
        "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts/fileServices/shares",
            "apiVersion": "2019-04-01",
            "properties": {
                "shareQuota": "100"
            },
            "name": "[concat(parameters('storageAccountName'), '/default/', parameters('fileShareName'))]",
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
            ]
        },

        {
            "type": "Microsoft.Storage/storageAccounts/fileServices/shares",
            "apiVersion": "2019-04-01",
            "properties": {
                "shareQuota": "100"
            },
            "name": "[concat(parameters('storageAccountName'), '/default/', parameters('fileShareName1'))]",
            "shareQuota": "100",
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
            ]
        },

        {
            "type": "Microsoft.Storage/storageAccounts/fileServices/shares",
            "apiVersion": "2019-04-01",
            "properties": {
                "shareQuota": "100"
            },
            "name": "[concat(parameters('storageAccountName'), '/default/', parameters('fileShareName2'))]",
            "shareQuota": "100",
            "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
            ]
        }

    ]
}
    ],
    "outputs": {}

}

jrd1989
  • 628
  • 10
  • 35

1 Answers1

2

The ARM resource for creating file shares supports providing a quota size using the shareQuota property, this value is in GB.

{
  "name": "string",
  "type": "Microsoft.Storage/storageAccounts/fileServices/shares",
  "apiVersion": "2019-04-01",
  "properties": {
    "shareQuota": "100"
  }
}
Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • Thanks for the response. I tried adding the "shareQuota" property to my template.json file and I get the following error - "The request content was invalid and could not be deserialized: 'Could not find member 'shareQuota' on object of type 'TemplateResource'. Path 'properties.template.resources[0].resources[0].shareQuota' – jrd1989 Dec 30 '19 at 19:24
  • Can you show the whole template? – Sam Cogan Dec 30 '19 at 19:24
  • added it above to the initial question – jrd1989 Dec 30 '19 at 19:38
  • My apologies, I forgot to remove some previous settings from my code above when I posted it. I was able to get it working by adding the setting you mentioned. I have the following for each share: { "type": "Microsoft.Storage/storageAccounts/fileServices/shares", "apiVersion": "2019-04-01", "properties": { "shareQuota": "100" }, – jrd1989 Dec 31 '19 at 19:36