Querying multiple application insights resources with REST API - azure

I'm trying to query two different application insight instances (instance A and B) trough the REST API. I'm using postman to send a GET http request to the API and followed the answer in this post, which was aiming towards the same goal, join request data from different applications insights: https://stackoverflow.com/a/52248597/17161618
Just as it says in the above mentioned post I'm acessing the instance A and passed the authentication through the request header in the format keyA:appIdA,KeyB:appIdB.
I'm sending the following query:" union app("AppIdA").traces,app("AppIdB").traces " and receive the following error: enter image description here
Does anyone know how can I get access to read logs in resource B ?

I don't think you can run cross-component queries using API keys. You should use AAD (Azure Active Directory) auth. Give AAD app access to both resources. Then you should be able to run such queries.

Related

How to pull Azure Cognitive Search Quota and usage?

I am trying to pull azure cognitive search current and quota .
Can anyone help me on:
" how can I get that information to csv using some service principle."
I found one link to pull this kind of data :
https://learn.microsoft.com/en-us/rest/api/searchservice/get-service-statistics
But I am not sure how to use this api to get above screenshot information.
The link you posted is the correct way to do it, it returns all the information you need.
It looks like this endpoint does not support OAuth2 & RBAC. So instead of using service principal, you need to provide the admin api-key in the request header.
You can check here how to access the api-key. If you'll be doing that from a powershell script, you can authenticate with your service principal and fetch the key using Get-AzSearchAdminKeyPair, then use this key to make a http request to get the statistics and finally convert them to CSV format.

How to use Power BI REST API's in Azure Data Factory

I am trying to create a list of all the workspaces and the reports contained in each one of them for a documentation project.
I found online that we can use this to get the workspaces, I wanna use it with a "web" activity:
https://api.powerbi.com/v1.0/myorg/groups
And then I want to use the IDs we get in the output with a foreach and another web activity inside of it and use this to get the reports in each workspace, then copy it somewhere (datalake or DB) :
https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports
But I don't know how to configure the activity and the authentication.
If there is a better way like connecting directly to Power BI I'm all ears, I tried to do a get data from web source but I don't have any "key" for API and organization authentication doesn't work.
When I run the code here: https://learn.microsoft.com/en-us/rest/api/power-bi/groups/getgroups it works perfectly.
Thanks in advance
'But I don't know how to configure the activity and the authentication.' For this question, I'm not sure if you don't know how to use access token to call an API.
Register an azure ad application with the api permission of 'https://analysis.windows.net/powerbi/api/Workspace.ReadWrite.All'
so that you can generate an access token by this application with
this scope. Add api permission.
Use ropc flow to generate an access token. This flow contains user information so that your api could know who you are to return correct groups.
Add 'Authorization' in request head with value of 'Bearer accessToken' to call the api.
ropc flow 1.0:

Azure Web Apps - List and Web Apps - List Functions Rest API response is empty

API execution Screenshot link
I have two azure Accounts [Account1 and Account2].
Account1 has less than 10 functions and Apps
Following API execution works fine and getting proper response
Account2 has 1000+ functions and Apps.
Following API execution doesn't work and response is empty.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Web/sites?api-version=2019-08-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/functions?api-version=2019-08-01
Is it a problem with azure API or I'm I missing something here.
I tried the api for getting the websites list , it worked for me. Under my subscription , i have 93 websites and overall resulting data was 42.84 KB in size.
I would suggest you to check the Bearer token and the permission set for the service principal you are using to query the data:
P.S. Same is with Function rest api too.
Hope it helps.

Enter a valid URI error in Azure Logic Apps

I am currently trying out Azure Logic Apps and am now trying to create
a first simple flow that acquires data from an external REST API.
I'm using FRED, a hosted Node-Red instance, to create an REST API end-point.
In FRED you use https://x_y.fred.sensetecnic.com/api/hello to access my mock API (where x_y is my user name).
Accessing "https://x_y.fred.sensetecnic.com/api/hello" in a browser returns the intended data as specified in the Node-Red flow. Same thing goes when accessing
"https://x_y.fred.sensetecnic.com/api/hello" using GET in Postman (then adding two required Headers, required by FRED).
The strange thing is that in my Azure Logic App, I am not able to even save the flow with my URI stated as "https://x_y.fred.sensetecnic.com/api/hello". It states "Enter a valid URI". I enter the headers as was required.
So I can get to the REST API directly from a browser or using Postman, but are not able to access it from within an Azure Logic App.
I test the problem is there is a special characters _ in your URI. You could have a try if you delete _ then it won't state error.
So you coudl Initialize a variable to store your name x_y, then insert the variable in the URI. The flow would be like this. If you don't find the name in Dynamic content, you could use variables('name') this expression to insert it.
With this way the GET method will run correctly.

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