I am deploying to an azure synapse environment queries using sqlcmd to serverless pool. The environment contains an SQL database that my deploying account has access to.
I am creating first the credentials to access a cosmosDB with :
CREATE DATABASE SCOPED CREDENTIAL [mycosmos] WITH IDENTITY = 'SHARED ACCESS SIGNATURE', SECRET = '<accessKeyToCosmosAccount>'
Then using the openrowset with the created credentials to retrieve records from the aforementioned COSMOSDB
SELECT TOP (100) *
from OPENROWSET (
PROVIDER = 'CosmosDB',
CONNECTION = 'Account=mycosmos;Database=reporting;',
OBJECT = 'data',
CREDENTIAL = 'mycosmos'
) as o;
however executing the latter gives the following error:
Resolving CosmosDB path has failed with error 'Secret is not base64 encoded.'.
Does anyone has tips or ideas on how to get more information or to understand the issue at hand?
the credentials are indeed created and I checked that by using:
SELECT * FROM SYS.database_scoped_credentials
I also tried to base64 the secret accessKeyToCosmosAccount
using
echo $mysecret | tr -d '\n\r' | base64 -w 0
to no avail (I still keep getting the same error)
thanks