I am trying to get the connection string for a cosmos db. In powershell when I do
Invoke-AzureRmResourceAction -Action listKeys -ResourceType "Microsoft.DocumentDb/databaseAccounts" -ApiVersion "2015-04-08" -ResourceGroupName $ResourceGroupName -Name $dbName | fl
I get a result showing the keys.
D:\> Invoke-AzureRmResourceAction -Action listKeys ` >> -ResourceType "Microsoft.DocumentDb/databaseAccounts" ` >> -ApiVersion "2015-04-08" ` >> -ResourceGroupName $ResourceGroupName -Name $dbName | fl Confirm Are you sure you want to invoke the 'listKeys' action on the following resource: /subscriptions/(snip)/resourceGroups/example/providers/Microsoft.DocumentDb/databaseAccounts/myExampleDb [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y primaryMasterKey : (snip) secondaryMasterKey : (snip) primaryReadonlyMasterKey : (snip) secondaryReadonlyMasterKey : (snip) D:\>
However if I try to list the connection strings, like the example in the documentation shows, I get no results
D:\> Invoke-AzureRmResourceAction -Action listConnectionStrings ` >> -ResourceType "Microsoft.DocumentDb/databaseAccounts" ` >> -ApiVersion "2015-04-08" ` >> -ResourceGroupName $ResourceGroupName -Name $dbName | fl Confirm Are you sure you want to invoke the 'listConnectionStrings' action on the following resource: /subscriptions/(snip)/resourceGroups/example/providers/Microsoft.DocumentDb/databaseAccounts/myExampleDb [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y D:\>
With a resource manager template, if I deploy the following resource manager template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dbName": {
"type": "string"
}
},
"resources": [
],
"outputs": {
"listConnectionStrings": {
"type": "object",
"value": "[listConnectionStrings(resourceid('Microsoft.DocumentDB/databaseAccounts', parameters('dbName')), '2016-03-19')]"
},
"listkeys": {
"type": "object",
"value": "[listKeys(resourceid('Microsoft.DocumentDB/databaseAccounts', parameters('dbName')), '2016-03-19')]"
}
}
}
I get back from the outputs
{
"listConnectionStrings": {
},
"listkeys": {
"primaryMasterKey": "(snip)",
"secondaryMasterKey": "(snip)",
"primaryReadonlyMasterKey": "(snip)",
"secondaryReadonlyMasterKey": "(snip)"
}
}
What am I doing wrong that prevents the connection strings from being shown?