li-raz li-raz - 2 months ago 25
reST (reStructuredText) Question

Azure - trying to create encrypted storage account

the storage account encryption is finally live
and I have tried to create an encrypted storage account using REST call
and i am getting an error
my url is


https://management.azure.com/subscriptions/dddddd-cccccc/resourceGroups/Encryptedrg/providers/Microsoft.Storage/storageAccounts/i2lhqulophtmyu2?api-version=2016-01-01


but I am getting an error which - according to it, Azure thinks I am sending the old request


Error Message: Code: AccountTypeMissing Message: The accountType field is missing from the request.

Answer

I have tested on my local. Please double check your code with my reply. Here is the result: enter image description here

The Rest API document: https://msdn.microsoft.com/en-us/library/azure/mt163564.aspx

PUT:

https://management.azure.com/subscriptions/{subscription ID}/resourceGroups/jatestgroup/providers/Microsoft.Storage/storageAccounts/akingtt?api-version=2016-01-01

Header:

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhb......
Content-Type: application/json
Host: management.azure.com
Content-Length: 443

Request Body

{
    "location": "East Asia",
    "tags": {

    },
    "properties": {

        "encryption": {
                "services": {
                         "blob": {
                                 "enabled": true
                         }
                },
                "keySource": "Microsoft.Storage"    
        }
    },
    "sku": {
        "name": "Standard_RAGRS"
    },   
    "kind": "Storage"
}

Please note:
1) "Kind" is Required in version 2016-01-01 and later.
2) "accessTier" is Required when kind = 'BlobStorage'. Forbidden when kind = 'Storage'.
3) prior to version 2016-01-01, 'sku' was called 'accountType' and was found under the 'properties' envelope.