How to associate a valid subscription with your Azure App?
Here is the guide that Microsoft provided:
https://learn.microsoft.com/en-us/graph/metered-api-setup?tabs=commandprompt
And to highlight the most important steps, we will break them down:
1- Open a CMD and log in to Azure with your global admin account using Az module, if you don’t have it you can install it from here: Install Azure PowerShell on Windows | Microsoft Learn.
2- Now open your Azure portal and navigate to the subscription page, assuming you already have a valid subscription, go to Resource groups and create a new one.
3- After making sure you already have the resource group, you can run the following command in CMD and insert the appropriate information for your app:
az resource create --resource-group myRG --name myGraphAppBilling --resource-type Microsoft.GraphServices/accounts --properties "{""appId"": ""myAppGUID""}" --location Global --subscription mySubscriptionGUID
You need to change the following:
Parameter | Description |
---|---|
myRG | The name of an existing Azure resource group to add the newly created resource to. |
myGraphAppBilling | The name you want to give to this resource instance. |
myAppGUID | The Application (client) ID of the application being enabled, provided as a string parameter; for example, 00000000-0000-0000-0000-000000000000. |
mySubscriptionGUID | The ID of the Azure subscription that will receive billing events, provided as a string parameter; for example, 00000000-0000-0000-0000-000000000000. |
4- After doing this and getting a success message in the CMD, you can open your resource group and should be able to see a new resource "myGraphAppBilling" created under this group; if you do not see it, it is probably hidden and you need to check the "Show hidden types" box.