You can use ARM template to deploy storage account with "Allow Blob public access" set to Disabled.
For a fast demo, this is my template for the storage account:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storagePrefix": {
"type": "string",
"minLength": 3,
"maxLength": 11
},
"storageSKU": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS",
"Standard_RAGRS",
"Standard_ZRS",
"Premium_LRS",
"Premium_ZRS",
"Standard_GZRS",
"Standard_RAGZRS"
]
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"variables": {
"uniqueStorageName": "[concat(parameters('storagePrefix'), '4testonly')]"
},
"resources": [{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"name": "[variables('uniqueStorageName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[parameters('storageSKU')]"
},
"kind": "StorageV2",
"properties": {
"supportsHttpsTrafficOnly": true,
"allowBlobPublicAccess": false
}
}
],
"outputs": {
"result": {
"type": "string",
"value": "done"
}
}
}
allowBlobPublicAccess set to false.
This is the code using fluent API to create this deployment:
var storageAccountName = "<your new storage account name>";
var templateJson = File.ReadAllText(@"<path of template file>\storageOnly.json");
azure.Deployments.Define("storageDepolyTest")
.WithExistingResourceGroup("<your resource group name>")
.WithTemplate(templateJson)
.WithParameters("{\"storagePrefix\":{\"value\":\""+ storageAccountName + "\"}}")
.WithMode(DeploymentMode.Incremental)
.Create();
Result: