How to tell the difference between free-tier Azure CosmosDB account and the paid one?

Viewed 444

When I create a new account using Azure portal, I can see "Apply Free Tier Discount" option. And this option is absent when there is an existing free-tier account in the current subscription.

But after the account is created I can't tell if it's free-tier or not. Can't find any difference between free-tier and not free-tier accounts either in the account properties in Azure portal either in ARM template auto-generated for the account. All templates have the same property "databaseAccountOfferType": "Standard". Somehow MS knows when one free-tier for a subscription already exists. So there is some indicator somewhere inside, but it's hidden from Azure portal users.

And another question: can I create a free-tier account using ARM template? If so, how can I be sure that I created a free-tier account if I use ARM template?

2 Answers

To find out if an account is created in free tier or not, you could fetch the properties of that account. I tried by executing REST API from here: https://docs.microsoft.com/en-us/rest/api/cosmos-db-resource-provider/databaseaccounts/get.

Under properties node, you will see a property called enableFreeTier. That property's value will be true for free account and false for other accounts.

This is what I see when I run the REST API:

  "properties": {
    "provisioningState": "Succeeded",
    "documentEndpoint": "https://account.documents.azure.com:443/",
    "ipRangeFilter": "",
    "publicNetworkAccess": "Enabled",
    "enableAutomaticFailover": false,
    "enableMultipleWriteLocations": false,
    "enablePartitionKeyMonitor": false,
    "isVirtualNetworkFilterEnabled": false,
    "virtualNetworkRules": [],
    "EnabledApiTypes": "Sql",
    "disableKeyBasedMetadataWriteAccess": false,
    "enableFreeTier": true,//True is returned for free account, false otherwise
    "apiProperties": null,
    "databaseAccountOfferType": "Standard",
    "consistencyPolicy": {
      "defaultConsistencyLevel": "Session",
      "maxIntervalInSeconds": 5,
      "maxStalenessPrefix": 100
    },

For the sake of completeness, copying @juunas's comment about ARM template.

Here's the link to the ARM template that can be used to create a "free" account: https://gist.github.com/markjbrown/03d3640a2d915f5899b84e5927e4e589.

Not sure if it was not exposed on portal before, but currently this is also visible in Azure Portal on account overview blade under Essentials it is displayed as "Free Tier Discount" with value of either "Opted Out" or "Opted In".

Related