Azure-docs: Example doesn't work with Azure blob containers

Created on 5 Jun 2019  Â·  9Comments  Â·  Source: MicrosoftDocs/azure-docs

The example says to "Upload the data to the root of an Azure Blob Storage account." It seems like we have to create a container within the blob first, before we can upload files. With that, the api call fails with "Unable to list blobs on the Azure Blob storage account." Is there another option of generating the correct SAS URL?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cognitive-servicesvc cxp form-recognizesubsvc product-question triaged

Most helpful comment

@YutongTie-MSFT, I walked into the same issue as iamsop. I think the text:

"Replace SAS URL with an Azure Blob storage container shared access signature (SAS) URL of the location of the training data."
Would be more clear if you add a line like
"Retrieve your SAS-URL by clicking 'Shared Access Signature' under settings menu in the storage account and 'Generate SAS and connection string' . This will show the Blob service SAS URL. Adjust this url by adding the containername After .net/ and before ?sv= in the url, eg: .blob.core.windows.net//?sv=…. This is the SAS-URL to be used.

All 9 comments

Thanks for the feedback! We are currently investigating and will update you shortly.

hello,

I was able to resolve this. You put the name of the container in the source blob SAS URL. Example - "yourblobname.blob.core.windows.net/<name_of_your_container>/rest of the sas url"

@iamsop Hi, thank you for sharing this. How do you think we can make the document clearer?

@YutongTie-MSFT, I walked into the same issue as iamsop. I think the text:

"Replace SAS URL with an Azure Blob storage container shared access signature (SAS) URL of the location of the training data."
Would be more clear if you add a line like
"Retrieve your SAS-URL by clicking 'Shared Access Signature' under settings menu in the storage account and 'Generate SAS and connection string' . This will show the Blob service SAS URL. Adjust this url by adding the containername After .net/ and before ?sv= in the url, eg: .blob.core.windows.net//?sv=…. This is the SAS-URL to be used.

@iamsop Thank you for your advice, I will update the document to make it more clear.
We will now proceed to close this thread. If there are further questions regarding this matter, please respond here and @YutongTie-MSFT and we will gladly continue the discussion.

(I'm going to replace my why-is-this-(still-)not-working comments with some notes that might help other people in the future)

(I'm going to replace my why-is-this-(still-)not-working comments with some notes that might help other people in the future)

(I'm going to replace my why-is-this-(still-)not-working comments with some notes that might help other people in the future)

Hints for newbs like me (taken from my previous comments in this thread which I'm going to hide for clarity):

  1. A blob storage container is required to dump the training documents in (go to Storage Accounts / {account name} / Blobs / + Container (give it a name and leave "Public access level" as "Private (no anonymous access)"
  2. Click into the container and upload the training documents - all in the root folder, no sub folders (there can be a delay after the uploads say that they are complete before they are actually displayed within the container)
  3. Create a shared access signature (SAS) for the blob container - start again at Storage Accounts / {account name} then don't go into Blobs, go into Shared access signature - the Allowed permissions only need to be Read and List, click "Generate SAS and connection string" and copy the "Blob service SAS URL"
  4. Paste this URL into notepad (or whatever) and insert the name of the container before the query string
  5. Now you may use commands such as

curl -X POST "{endpoint}/formrecognizer/v1.0-preview/custom/train" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: {subscription key}" --data-ascii "{'source': '{SAS url}'}"

  • Replace "{endpoint}" with the provided API endpoint (may look something like https://region.api.cognitive.microsoft.com)
  • Replace {subscription key} with the key available via the Form Reognizer resource overview tab
  • Replace {SAS url} with the SAS URL generated above, the tweaked version that includes the container name

_(Note: My personal preference with the command above is to use single quotes within the "data-ascii" value rather than double quotes because then you don't need to escape them, making the command easier to read and to write)_

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

DeepPuddles picture DeepPuddles  Â·  3Comments

ianpowell2017 picture ianpowell2017  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

AronT-TLV picture AronT-TLV  Â·  3Comments