azure-sdk-for-python: ResourceNotFoundError (404) with DocumentIntelligenceClient

Environment:

  • Python Version: 3.9.13
  • Old SDK: azure-ai-formrecognizer 3.3.2
  • New SDK: azure-ai-documentintelligence 1.0.0b1

Issue: I am facing a ResourceNotFoundError (404) when using DocumentIntelligenceClient in the new Azure SDK version 1.0.0b1. The old SDK version 3.3.2 (DocumentAnalysisClient) works fine with the same endpoint and key.

Reproducible Steps:

  1. Working Code with Old SDK (azure-ai-formrecognizer 3.3.2):

    from azure.core.credentials import AzureKeyCredential
    from azure.ai.formrecognizer import DocumentAnalysisClient
    
    endpoint = os.environ["ENDPOINT"]
    key = os.environ["API_KEY"]
    
    client = DocumentAnalysisClient(endpoint=endpoint, credential=AzureKeyCredential(key))
    with open(path_to_sample_documents, "rb") as f:
        poller = client.begin_analyze_document("prebuilt-layout", f)
    
  2. Non-Working Code with New SDK (azure-ai-documentintelligence 1.0.0b1):

    from azure.core.credentials import AzureKeyCredential
    from azure.ai.documentintelligence import DocumentIntelligenceClient
    
    endpoint = os.environ["ENDPOINT"]
    key = os.environ["API_KEY"]
    
    client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
    with open(path_to_sample_documents, "rb") as f:
        poller = client.begin_analyze_document("prebuilt-layout", f)
    

Error Message:

azure.core.exceptions.ResourceNotFoundError: (404) Resource not found

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

FYI I think it is to do with the region, I found this here. image