Azure Cost Management REST API authorization suddenly stopped working

86 views Asked by At

On October 18th 2023 our server-to-server integration to Azure Cost Management APIs stopped working. We're using a multi-tenant App Registration which has been admin consented to our own and the customer environments. With the same App Registration we're still successfully querying other Azure APIs, such as Azure Advisor, Resource Manager, Policy Insights etc.

The error message received from the API call

Status code 401, "{"error":{"code":"401","message":"RequestDenied. Your request to this resource has been blocked. Please contact Microsoft, to re-enable access."}}

Everything worked with the same configurations before the 18th so this leads me to believe we've been somehow marked as spam on the Cost Management API or there has been some change in Azure that we haven't been informed. Has anybody else faced similar issue and how did you resolve it? Microsoft Support is awfully slow handling this and our customers are not happy.

The problem occurs both with using Cost Management Java library or by using raw HTTP requests.

1

There are 1 answers

0
Teemu Sakari On

This was caused by having an illegal character in the request body. It was causing performance issues in Azure and they decided to block our Service Principal.

Funny thing is that the illegal character originated from a tag of an Azure Resource.

Solved by filtering out tags that contains ', " or \ characters.