Switch to the New Defender for Storage Pricing Plan
Published Jan 08 2023 04:47 PM 8,996 Views


Hi folks! My name is Felipe Binotto, Cloud Solution Architect, based in Australia.

If you missed, a new pricing plan has been announced for Microsoft Defender for Storage.

The legacy pricing plan (per-transaction) is priced at $0.02 per 10K transactions, which can become a bit expensive if the Storage Account has a very large number of transactions.




The new pricing plan (per-storage-account) is priced at $10 per storage account which includes 73M transactions. Storage Accounts exceeding 73M transactions will be charged $0.1492 per 1M transactions.




We have made available a workbook which can scan all your storage accounts and provide the pricing for the legacy and for the new pricing plans.

For more information visit this link.



This new pricing plan is huge for most enterprise customers. This has the potential to reduce your Microsoft Defender for Storage cost dramatically.

The following is an example of the workbook displaying the cost for the new pricing plan across all the storage accounts enabled for Defender for Storage Account.




And the following is an example of the same storage accounts in the legacy pricing plan.




Huge savings!!!



Storage Accounts with less than 4.5M transactions per month will not benefit from the new plan and may continue in the per-transaction plan.

The new pricing plan does not support excluding Storage Accounts from Defender for Storage protection. It is enabled at the subscription level and all Storage Accounts under that subscription are switched to the new plan. Refer to the FAQ.

For more information on how the exclusions work, refer to this link.


Switch to the new pricing plan

The easiest way is to switch from the Azure Portal. However, if you have a large number of subscriptions this activity can be super boring!

Currently, there is no native PowerShell cmdlets which can help with the switch, but we can leverage the Microsoft Defender for Cloud REST API.

For information about all the options to do the switch, refer to this link.


The script

To make your life easier, I have already developed the script to switch the plan. This script will switch all Storage Accounts to the new plan. Adapt it for your requirements.

First step before your run the script is to connect to Azure using the Connect-AzAccount cmdlet.






foreach($subId in (Get-AzSubscription | ? State -eq "Enabled").Id){

    $payload = @"


    "properties": {
    "pricingTier": "Standard",
    "subPlan": "PerStorageAccount"


    $result = (Invoke-AzRestMethod -SubscriptionId $subId -Method Get -ResourceProviderName 'Microsoft.Security' -ApiVersion 2022-03-01 -Name StorageAccounts -ResourceType pricings).content | ConvertFrom-Json

    if($result.properties.pricingtier -eq "Free"){

        Write-Host "Subscription $subId is on the Free pricing tier"



        Invoke-AzRestMethod -SubscriptionId $subId -Method Put -ResourceProviderName 'Microsoft.Security' -ApiVersion 2022-03-01 -Name StorageAccounts -ResourceType pricings -Payload $payload

        Write-Host "Subscription $subId is on the Standard pricing tier and has been converted to new pricing model"







Download the workbook now and evaluate how much are your potential savings. This is one of the easiest ways to save on your Azure spendings.


I hope this was informative to you and thanks for reading. Happy new year!




The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.

Version history
Last update:
‎Feb 22 2023 04:51 PM
Updated by: