Jesse
Jesse

Reputation: 3642

Logic app CosmosDb Stored Procedure connector returns Unauthorized

I created a Stored Procedure in my CosmosDb database to delete a number of files in the collection based on a property. The structure of the database looks like this:

Database Test
| - Collection
  | - Documents
  | - Stored Procedures
    | - CleanupByProperty

I then created a Logic App, that executes this Stored Procedure. I connected via the Portal to the Cosmos database, using the Read/Write Primary Key. When creating the connector in the Logic App, it couldn't read the collections from my database server, giving the following error:

Error message

Could not retrieve values. The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used.

If I manually filled in the fields for Collection ID and Sproc ID, and ran the Logic App, it returned Unauthorized on the action.

Unauthorized

What am I doing wrong here?

Upvotes: 1

Views: 539

Answers (1)

Jesse
Jesse

Reputation: 3642

It's because there's a space in the database name

After tinkering around for a while, I found that when I created the exact same scenario, but with the database named Database-Test instead of Database Test, the Logic App could successfully retrieve the Collections of my database, and the Stored Procedure, and it ran without issues.


I'm not sure why this is the case, because according to the documentation, a database name can contain the following:

Database names must contain from 1 through 255 characters, and they cannot contain /, \, #, ?, or a trailing space.

This implies that Database Test is a valid name, which it is (everything else works fine), however I can't seem to connect to it using my Logic App.


Issue raised on MSDN Forums to hopefully get more information on why this happens.

Response from Microsoft confirms this as a bug in the Logic App:

I have reproduced & validated this issue and reached out to product team. please stay tuned for updates.

UPDATE:

I have raised it internally with the PG and will provide the next update soon.

Upvotes: 1

Related Questions