How is my connection string used in ruby azure-storage-table gem to connect to Azure cosmos db?

Viewed 22

I'm building a Ruby program to connect to Azure cosmos db, using the azure-storage-table gem (rubygems, github).

The microsoft instructions here are pretty simple and clean, but they don't quite explain how I use the connection string properly:


https://docs.microsoft.com/en-us/azure/cosmos-db/table/how-to-use-ruby

Add an Azure Cosmos DB connection

To connect to Azure Cosmos DB, copy your primary connection string from the Azure portal, and create a Client object using your copied connection string. You can pass the Client object when you create a TableService object:

common_client = Azure::Storage::Common::Client.create(storage_account_name:'myaccount', storage_access_key:'mykey', storage_table_host:'mycosmosdb_endpoint')
table_client = Azure::Storage::Table::TableService.new(client: common_client)

My connection string looks like the following: screenshot of my cosmos connection strings

The PRIMARY READ-ONLY CONNECTION STRING is:

AccountEndpoint=https://{azureCosmosDBAccount}.documents.azure.com:443/;AccountKey={myAccountKey}

So I'm confused about how to translate this connection string into the format prescribed by microsoft in the example above.

common_client = Azure::Storage::Common::Client.create(storage_account_name:'myaccount', storage_access_key:'mykey', storage_table_host:'mycosmosdb_endpoint')

My connection string doesn't have a 'myaccount' value, what is this, where does this come from?

This instruction doesn't make sense to me, as I'm trying to connect to cosmos db, not an Azure Storage Account.

Or, alternatively, can I pass the connection string into the Client.create object under a different parameter name?

0 Answers
Related