Home > front end >  Cannot acquire data from CosmosDB through app
Cannot acquire data from CosmosDB through app

Time:04-20

I am having trouble connecting to Azue Cosmos db using azure connection string, like that:

new CosmosClient("AccountEndpoint=https://XADDRESS:443/;AccountKey=XKEY;");

Executing following like gives me error in about 2-3min:

await cos.CreateDatabaseIfNotExistsAsync("DBNAME")

Error message: The requested name is valid, but no data of the requested type was found

I have downloaded emulator to test locally created cosmos db and everything seems to be working there without any problems. Might it be firewall or dns problem? I have also no problem creating my own db/container or add an item directly through Azure portal.

CodePudding user response:

Without seeing everything in context some simple troubleshooting tasks would include:

See if you currently have configured your DB with "All Networks" or "Selected Networks" within the "Firewall and virtual networks" section of the portal Selected networks setting requires a firewall configuration.

Firewall and virtual networks

Review document Configure IP firewall in Azure Cosmos DB to validate you've allowed any specific IP addresses (if you are running the app locally).

  • Related