I am using the API mentioned on https://msdn.microsoft.com/en-us/library/azure/mt219004.aspx to get the information on how much individual Azure resources is charging.
However I am getting a 401 response with error message as
The 'Authorization' header is missing."
There seems to be lack of documentation on how to make the API call with proper authentication.
Thanks for any help in advance.
If you are making the call interactively, you can use the same AuthenticationContext.AcquireToken method the billing reference application is using to authenticate example source.
If you want to call the billing API unattended from a service for instance, I have an example here using a service principal.
Related
I have a very strange issue with Azure API Management, that I don't seem to figure out...
We have an API operation that is part of an APIM API that is linked with a Product that does not require a subscription. The intention is that this API endpoint is publicly available for consumers, without requiring any subscription keys, headers, etc...
When I call this endpoint from Postman, it works.
When I just do a GET to the endpoint in a private browser session (so nothing added in headers, etc), it works.
When I execute the API operation from the Azure APIM portal, without selecting a product, it works.
But, when I call the endpoint from a deployed web app in Azure App Service, I get a 401 back?!
So, the obvious thing is that something is misconfigured, but I cannot get my head around it...
When looking in Application Insights, linked to the APIM instance, this is the trace, I see:
But in the following screenshot, I get a hint of the mismatch, though I don't understand how this happens... If I copy the full url to a browser private session, I get back a 200 with successful data.
But the root cause of the 401 is probably in the yellow box, where there is an API product dev-product-admin, which indeed requires a subscription (and has JWT token policies configured). So, what I need to find out now, is how I can make sure that APIM is linking my incoming request to the right product, which doesn't require a subscription. Any hints?
And two minutes after writing down the question, you get your own insight...
I checked the code and I was adding a SubscriptionKey header to that specific call (because of a configuration issue). And that subscription key was obviously making the link to the specific Product (which indeed requires more authorization)
I am trying to access Microsoft Graph API to search the list items present in tenant. I am having no problem when GET request is executed for users or groups.
When I post the request for search using HttpClient as described on MS site. I am getting below error.
Failed to call the web API: BadRequest
Content: {"error":{"code":"System.Exception","message":"SearchRequest Invalid (Region is required when request with application permission.)\r\nRegion is required when request with application permission.","target":"","details":null,"warnings":null,"level":"Error","httpCode":400},"Instrumentation":{"TraceId":null}}
I tried with .Net core as well. same error.
If i paste access code on HTML file, calling api for search using Ajax is working fine.
what code i am missing in my c# code.
The reason should be this endpoint you use not support application permission.
Usually this error message is encountered, indicating that application permission is not supported, you can use delegated permissions.
Cloud Connection getting error on Azure, Rest API & Callback API Configuration trying to make but not connecting on it giveing error
Welcome to Stack Overflow! There are a couple ways to call REST APIs in Azure. There is a neat video that explains how to do this via Postman here. Also ensure that the access token being used for Authentication is a valid one in the Authorization header. Refer to this doc to understand the right format.
I have configured Azure Application Insight for monitoring our systems and was trying to enable the alerting. I'm using app insight availability test which provides a functionality to call a webhook URL.
I wrote a webhook using HTTP triggered Azure function, but the problem is it exposes a public URL which if called will raise an alarm on our internal alerting system. So I plan to authenticate the call to webhook.
Is there any way I can authenticate the call possibly using OAUTH.I don't want to provide the token in URL, looking for something secure. Another problem with manually using token in URL is that token rotation will require manual work.
Any suggestions on I can automate this task which will take care of secret rotation will be appreciated.
I believe token based authentication is the only possible route as of today as documented here.
But I think you should still be able to use a Function App without worrying about key rotation since the function keys can be read through the Functions API if the AzureWebJobsSecretStorageType app setting is set to files as documented here.
I'm trying to implement authentication to my web API. I need to firstly authenticate one user to access some methods. I use the Azure AD, an automatic tool in Azure. The problem is that when I try it in Soap UI, I get the error bellow:
Org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException:
Error: Unexpected element: CDATA
And I guess the problem is that it returns the login page of Microsoft.
I'm sorry for not putting some code here or maybe any other detail, but I am really messy about this.
Thanks!