Unable to post message to Azure Service Bus Queue from Azure API using Managed Identity - azure

I am trying to test out the sample code by azure "Authenticate using Managed Identity to access Service Bus" and its on github:
Azure API Management Policy Snippets
What I have done is in below steps:
Created an Azure API Management Service. In this I added an API which has a POST method
I also enabled a System Generated Managed Identity for this APIM
I created a Service Bus and create a queue
I added the managed identity to a role of "Azure Service Bus Data Sender" on the queue.
Last, I modified the code from azure to have names from objects I created above and it looks like below:
On running a test on API I get error: "500 Internal Server Error". The message of course is not being sent. Any idea what I may be doing wrong here? Help appreciated.

It seems to be issue with your Authorization header and the calling URL. All other steps looks good.
Please find below Policy code snippet which works fine at my end. I am able to send the data to service bus successfully. My operation endpoint is '/messages' with POST method.

I found the issue which is almost what #pankaj has suggested.
I made a mistake when I created a POST operation on the api I created. When we add an operation for an api in azure apim, it asks for a URL also as shown below:
[![Azure API - adding an Operation][1]
The issue was that I added a random text something like "/message".
What this does is, it adds this path to the set-backend-service base-url
As that modified backend url was incorrect, so was the reason for error. I updated it to just a "/" in the POST operation path and the error got resolved.
I then again faced this issue when my request had some query parameters. It was again appending these query parameters to the backend url. To resolve that I added below:
<set-query-parameter name="{{replace-with-query-param}}" exists-action="delete" />
Thank you everyone for trying to help me. Hopefully, this post will be of some help to others
[1]: https://i.stack.imgur.com/Rechc.jpg

Related

PowerBI Refresh Through Azure Data Factory

I have developed a Pipeline according to the post "https://www.moderndata.ai/2019/05/powerbi-dataset-refresh-using-adf/#comment-2610".
However I keep getting an error "Invoking Web Activity failed with HttpStatusCode - 'Unauthorized', message - '' in the CALL DATASET REFRESH WEB ACTIVITY.
I haven't registered the Security Group for API access using the Service Principals. Could this be causing an issue ?.note(I am not the PowerB admin)
Not sure what is causing this issue.
When I execute the same thing through a Powershell script it works fine. Not sure why it is not working through the azure datafactory.
Just from the error message, you don't have the permission to access/refresh the PowerBI. The post you reference also said you must has the request permission.
Please request for the access and test again.

Azure Application Insight Work items authorization error

My purpose is to create bug in Azure DevOps directly from Azure Application Insight, I am doing to attach the work item (bug) feature available in Azure Application Insight but on clicking Authorize button it give me following error
Authorization token provided through OAuth does not have access to read/write work items for requested uri/project collection/project
for reference please find the below image.
Updates:
I didnt understand what you meant by private browser, and I have full admin access over Azure Portal.
basically I have the https://dev.azure.com/HealthTechnologies/ReportItNow link in which
https://dev.azure.com is the devop url
HealthTechnologies is the organization
ReportItNow is the Project
so in Azure insight workitem section, URL I am putting https://dev.azure.com/HealthTechnologies/ and in project I am putting ReportItNow, I dont know what i am doing wrong.
Still waiting for this glitch to solve.
Oky let me make it more simple, if I want to automatically create bug in Azure DevOps when ever any new exception came in to the Azure
Application Insight How I can get this into real practical.
I solve this when I took a detailed look at the error message url. It's saying that the missing authorization is for https://uri/Project Collection/Project. Based on that, I changed my url from https://dev.azure.com/organization to https://dev.azure.com/ and it worked,

Unable to add API access entry

I have created three B2C applications:
TestWebApp
TestApiOne
TestApiTwo
Both API applications were created the exact same way. Web API access is enabled, reply URLs have been specified, an App ID URL has been assigned, and keys have been generated. Both APIs have an additional read and write scope.
In TestWebApp API access, I am able to add TestApiOne with all three scopes without an issue.
When trying to add TestApiTwo to the TestWebApp API access list, the operation fails with the following error.
Failed to add the API access. Reason: The B2C service has an internal
error. If you created this B2C directory just now, please try again
after couple of minutes. If the problem persists, please contact
Support
(https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-support/).
If you do not have a B2C directory you can refer
https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-get-started/
I thought maybe there is a limit of one API per application. To test, I created a temporary application "TempApp". I received the same error displayed above while trying to add API access for both TestApiOne and TestApiTwo.
Has anyone else experienced this issue?
There's not a limit of one API per application. I have done research and it works fine by my side.
Please have a look at the guide and check your steps.
I have tried to replicate the issues that you are facing by putting diff redirect reply url domains and also by making one application to be native and one normal web app but it doesn't help.
Could you try to delete all the webapps and try making 1 and then adding another to it.
Then create the 3rd one.
Please check this or if you can share some screen shots. That would be helpful.
You can definitely add multiple web apps to api access of one web app.

Azure API Management REST API calls suddenly fail

I'm automating parts of my API Management tenant and suddenly receive '401 Unauthorized' messages in my code. Any ideas how I can detect why this is happening?
heck to see if you still have an authorization header included in your requests (as probably will be the case). In there you see a querystring like value starting with &ex=[SOME DATA/TIME VALUE]. Like this:
Authorization: SharedAccessSignature uid=53dd860e1b72ff0467030003&ex=2014-08-04T22:03:00.0000000Z&sn=ItH6scUyCazNKHULKA0Yv6T+Skk4bdVmLqcPPPdWoxl2n1+rVbhKlplFrqjkoUFRr0og4wjeDz4yfThC82OjfQ==
This probably is an expired date. Regenerate a new SAS in the portal or through code. In the Azure portal you can click on Manage and in the AAM portal you click on 'Security', as described here: https://msdn.microsoft.com/en-us/library/azure/dn798668.aspx#ProgrammaticallyCreateToken

Azure Mobile Services : GET operation from table

I'm trying to get data from a table I created in Azure Mobile Services.
When I setup the service, I created a new database to go along with it.
I've added a row of data to my table called TODOITEM and can query this row of data fine from the db admin tool on Azure.
Now what I'm trying to do is run a GET request on this table, as documented here...
https://msdn.microsoft.com/en-us/library/azure/jj677199.aspx
I am using Fiddler and trying to send the following request with HTTP 1.1...
https://mobilemeshtest.azure-mobile.net/tables/todoitem
X-ZUMO-APPLICATION: my azure mobile services key
X-ZUMO-AUTH: my facebook authentication key
Host: mobilemeshtest.azure-mobile.net
No matter what I try, all I get back is a 404 not found.
I'm even copying what the guy did in a PluralSight video tutorial on Azure Mobile Services, and he gets a correct 200 response.
I can't see what I'm doing wrong.
404 is pretty simple. The url is wrong.
Propably you have not set your Controller right.
If your Controller is named SomethingController then the route is /tables/Something assuming you havent customized the default Routing methods
Application Key and Authorization Key is not needed if you haven't specified the corresponding authorization attribute
for example : [AuthorizeLevel(AuthorizationLevel.User)]
RESOLVED : I was using a .NET backend, it seems one has to publish their data objects and controllers first using Visual Studio.
This blog post has a good example on how to achieve this.
If I was using the Javascript backend option, the controllers are automatically setup for you.

Resources