Im following a tutorial on cosmosdb with CORE SQL and trying to create a database.
EndpointUri and Key are correct.
const string EndpointUri = "https://fergerg.azure.com:443/";
const string Key = "gvfvfdevgrvgre";
Then when creating a database:
string databaseName = "demoDB_" + Guid.NewGuid().ToString().Substring(0, 5);
client = new CosmosClient(EndpointUri, Key);
database = await client.CreateDatabaseIfNotExistsAsync(databaseName);
Error 403 is returned
Unhandled exception. System.AggregateException: One or more errors
occurred. (Response status code does not indicate success: Forbidden
(403); Substatus: 0; ActivityId: e10466; Reason:
({“code”:”Forbidden”,”message”:””Operation ‘POST’ on resource ‘dbs’
is not allowed through Azure Cosmos DB endpoint. Please switch on such
operations for your account, or perform this operation through Azure
Resource Manager, Azure Portal, Azure CLI or Azure
Powershell”rnActivityId: 14d3a978f6ee10466,
Microsoft.Azure.Documents.Common/2.14.0″} RequestUri:
https://sql-iknn-.documents.azure.com/dbs
So POST is forbidden on endpoint dbs:
documents.azure.com/dbs
I think this has changed, that this worked before but is now not possible anymore out of the box.
How do I give permission to send POST requests to this endpoint from remote code?