Can't follow Microsoft Learn instructions to add Hotel Sample Data Source

James Hippolite 20 Reputation points
2025-04-07T22:50:53.5633333+00:00

Getting the following error when trying to add Hotel sample data as the data source for my Index:

Azure AI Search notification

Failed to update indexer "hotels-sample-indexer", error: "Error with data source: Cosmos DB connection string is invalid. The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. Please adjust your data source definition in order to proceed."

I am following the instructions here: https://microsoftlearning.github.io/mslearn-knowledge-mining/Instructions/Exercises/08-exercise-debug-search-issues.html

Please note, this is trying to import Hotel sample data from a remote Cosmos DB, not mine, so I don't have the Account Key.

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,339 questions
{count} votes

Accepted answer
  1. Prabhavathi Manchala 2,315 Reputation points Microsoft External Staff Moderator
    2025-04-08T01:12:44.5366667+00:00

    Hi James Hippolite,

    The Azure AI Search indexer expects a valid Cosmos DB connection string, but in this case, the provided string is intentionally partial because the data is publicly accessible in read-only mode. A Base64 decoding error can occur if the tutorial isn't clear or the connection string is copied incorrectly, such as with extra line breaks or wrong characters.

    • Go back to the tutorial page and check that the connection string in the "Data source" step is correct.
    • The correct sample connection string, which doesn't require an Account Key is
    {
      "type": "cosmosdb",
      "credentials": {
        "connectionString": "AccountEndpoint=https://azuresamples.documents.azure.com:443/;"
      },
      "container": {
        "name": "Hotels"
      }
    }
    

    Some tools, like Azure portal or Postman, may need a full connection string with a key, but Azure AI Search can access the sample Cosmos DB without a key if public access is supported.

    • When using the Azure Portal, code, or CLI, make sure you're using the correct connection string that includes only the endpoint. The data source definition should not include an AccountKey field. Also, ensure the Cosmos DB API is set to SQL API, not MongoDB or Cassandra.
    • If the portal or tool requires a key, you can instead go to your Azure Cognitive Search service, click Import Data, select Samples, and choose the Hotels sample dataset.

    Please refer to the documents below.

    https://learn.microsoft.com/en-us/azure/search/search-get-started-portal#start-the-wizard

    https://learn.microsoft.com/en-us/azure/search/search-howto-index-cosmosdb?tabs=portal-check-indexer#try-with-sample-data

    Please accept as "Yes" if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.

    Let me know if you have any further Queries.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. James Hippolite 20 Reputation points
    2025-04-08T20:30:33.6133333+00:00

    Perfect answer, thanks. I was able to download to local and continue with the exercise.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.