Failed to get blob content present in my Azure storage container using Postman - azure-storage

I am trying to get blob content present in my Azure storage container using Postman.
I created a Service Principal in Azure Ad and got access token successfully using scope as https://storage.azure.com/.default
I am trying to call query in Postman like below:
GET
https://storageaccountname.blob.core.windows.net/containername/filename
When I am calling the above query to get the blob, I got the below error:
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>AuthenticationFailed</Code>
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:d60dec8d-401e-0084-0ccd-8be567000000
Time:2022-06-27T15:33:38.4195186Z</Message>
<AuthenticationErrorDetail>Authentication scheme Bearer is not supported in this version.</AuthenticationErrorDetail>
</Error>
What does the above error mean? Please help me to get rid of the error.

The error usually occurs if you missed adding x-ms-version header while calling the query.
I tried to reproduce the same in my environment and got the same error like below:
To resolve the error, I added x-ms-version header like below and got the blob content successfully:

Related

Error Trying to copy a sharepoint file to DL

Hello could someone please help me on this,
I am trying to copy sharepoint files to my DL but it's not working I got this error
{ "errorCode": "2200", "message": "ErrorCode=HttpRequestFailedWithClientError,
'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,
Message=Http request failed with client error, status code 403 Forbidden, please check your activity settings. If you configured a baseUrl that
includes path, please make sure it ends with '/'.\nRequest URL: ,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,
Message=The remote server returned an error: (403) Forbidden.,Source=System,'", "failureType": "UserError", "target": "Copy SharepointFile", "details": [] }
To copy data from SharePoint to azure data lake first you need to give permissions to the app by following below procedure:
register an app in azure and create client secret 1for that copy secret value, AppId, TenantId.
For granting permission open below url
https://[your_site_url]/_layouts/15/appinv.aspx
you will get as below:
fill the above fields. Permission Request XML:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read"/>
click on trust it.
After that create pipeline and create web activity with below URL format
URL: https://accounts.accesscontrol.windows.net/[Tenant-ID]/tokens/OAuth/
Body: grant_type=client_credentials&client_id=[Client-ID]#[Tenant-ID]&client_secret=[Client-Secret]&resource=00000003-0000-0ff1-ce00-000000000000/[Tenant-Name].sharepoint.com#[Tenant-ID]
Replace Tenant-ID , Client-Secret, Client-ID, Tenant-Name
with your details.
After success of web activity add copy data activity.
create linked services of http and data lake for.
HTTP linked service:
Base url: https://[site-url]/_api/web/GetFileByServerRelativeUrl('[relative-path-to-file]')/$value
Datalake linked service:
create dataset for source as below:
Additional headers: #{concat('Authorization: Bearer ', activity('<Web-activity-name>').output.access_token)}
Sink:
,
In my case I debug the pipeline without entering Additional headers I got below error:
After that I enter Additional headers and debug the pipeline, it executed successfully.
For more clarification you can refer this.
AFAIK for copy files from SharePoint to azure data lake when compare with Azure data factory or synapse Logic apps are better way. You can try with logic apps here

Azure storage account container access via browser- Getting authenticating error

We want to be able to give access to some users to a container that they can see a list of their files in the browser, click on them to read them.
I created a storage account. A container with public access and have created few blobs in a container and have set the container public access level to read.
But when I try to access that container in the browser I get the following error. I created a SAS token for it in storage explorer.
https://teststorageaccount21.blob.core.windows.net/publicc?sv=2019-12-12&st=2021-02-08T20%3A58%3A42Z&se=2021-03-09T20%3A58%3A00Z&sr=c&sp=rl&sig=AjF0IpWIBGZtBeKcOodd8HieENZ0F3Cuig54Y8e0oIM%3D
<Error>
<Code>AuthenticationFailed</Code>
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:9cb791c8-a01e-0016-625f-fe693a000000 Time:2021-02-08T21:16:09.2176268Z</Message>
<AuthenticationErrorDetail>Signature did not match. String to sign used was rl 2021-02-08T20:58:42Z 2021-03-09T20:58:00Z /blob/teststorageaccount21/$root 2019-12-12 c </AuthenticationErrorDetail>
</Error>
When I try to access a blob within that container, I can access it without any problems.
This link can be used to see the file
https://teststorageaccount21.blob.core.windows.net/publicc/MyTest1.csv?sv=2019-12-12&st=2021-02-08T21%3A20%3A53Z&se=2021-03-09T21%3A20%3A00Z&sr=b&sp=r&sig=%2Bw8oi73NUU4w%2FqgSAsNvjVHwBi0SgaoQAK6%2BF8P8QQs%3D
Why am I not able to see the list of blobs at the container level with public access. Also, I need help in understanding that authentication error. Not sure what signature didnt match.
Your SAS token is blob level, you need to generate SAS token in container level:
If you list blobs by https://<storage-account-name>.blob.core.windows.net/<container>?<sas-token> in the browser, you will receive an error:
<Error>
<Code>ContainerNotFound</Code>
<Message>The specified container does not exist. RequestId:54174bad-401e-0046-218e-fe53dd000000 Time:2021-02-09T02:52:30.1104394Z</Message>
</Error>
So you need to use List Blobs API, please use this format URL:
https://<storage-account-name>.blob.core.windows.net/<container>?restype=container&comp=list&<sas-token>

Azure File Storage the server responded with a status of 400 (Condition headers are not supported.)

I have some png files stored in Azure file Storage, and I'm retrieving and displaying it from my MVC web project to the browser. But sometimes I get the below error message from browser console.
Failed to load resource: the server responded with a status of 400
(Condition headers are not supported.)
If I refresh the page again, the error message disappears automatically. But it doesn't solve my problem as I run my MVC project again, the same error comes back. How to solve it?
It's acutally a common issue on Azure Storage, which be listed in the offical reference Common REST API Error Codes as the figure below.
It means that Get File REST API does not support those request headers which not be listed in the Request Headers.
There is a similar SO thread Azure File Storage Error: Condition Headers Are Not Supported, which got the same issue with yours. It seems to show up different behavior in different browses when you get a file from Azure File Storage.
I could not reproduce this issus by a file url with SAS token, but I really recommend that you need to store these static files like images on Azure Blob Storage, as I known and as Azure best practice, to show an image by its url with sas token or a public container.

When using Quickbooks Online API Collections for Postman I'm getting an Authentication Error

I've gone through the steps shown here https://developer.intuit.com/docs/0100_quickbooks_online/0100_essentials/000300_your_first_request/first_request_with_postman#/Configuring_the_Postman_Authorization_header-1500 to use Quickbook's API Collection for Postman.
In Postman, I was successfully able to get a new access token. I also updated the {{baseurl}} to be "sandbox-quickbooks.api.intuit.com", and updated the {{companyid}} (aka the "RealmId") to be the appropriate value as shown in the "Manage Sandboxes" page of the developer site (i.e. https://developer.intuit.com/v2/ui#/sandbox).
BUT when I click "send" on the "Customer-ReadById" query (or any other query in the collection), I get the following Authentication error:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2017-08-16T11:52:00.611-07:00">
<Fault type="AuthenticationFault">
<Error code="100">
<Message>General Authentication Error</Message>
<Detail>AuthenticationErrorGeneral: SRV-110-Authentication Failure , statusCode: 401</Detail>
</Error>
</Fault>
</IntuitResponse>
My next step was to verify that I can query my sandbox using the OAuth 2.0 Playground tool on the developers site, which I can indeed do.
My questions then are: why am I getting this authentication error in Postman? Am I missing a step? Or has something changed in the Quickbooks Online API that has not yet been documented?
EDIT: I've managed to resolve my own issue after a decent amount of trial and error, and with a hint based on a response in the Quickbooks Online help area.
For those who may find this useful, my solution was to request a new access token (click "Get New Access Token" in Postman) and updated the "Scope" section to include "openid" such that the space delimited list read:
com.intuit.quickbooks.accounting openid profile email phone address
Using this new token with the updated scope allowed me to get the desired results.
I had the same problem but I resolved it differently. My issue was that in the requested token, the default to "Add token to" is URL, but it seems that the API requires the token to be in an Authorization header. Changing this to "Header" does just that.
For the "Customer-ReadById" endpoint, the only scope that should be necessary is com.intuit.quickbooks.accounting. My guess is you changed it to Header in your trial and error.

401 unauthorized error while creating object in back4app via Temboo

I am creating an object in parse (using back4app parse server for this).
I get the following error when I run the choreo in temboo.
A HTTP Error has occurred: The remote server responded with a status
code of 401. Typically this indicates that an authorization error
occurred while attempting to access the remote resource. The data
returned from the remote server was: {"error":"unauthorized"} . The
error occurred in the HTTPSend (Parse) step.
That 401 error might indicate that the Id or Keys are not correct. Maybe it could be a good idea to double check them.
Also, what is the host and path for the API Request that you're doing with Temboo (I'm not acquainted with it)? If you're not using the correct ones it might cause problems too.
Make sure you're reaching something like this:
https://parseapi.back4app.com/classes/Your_Class_Name