您可以使用listkeys模板函数来检索您的 configStore 键和连接字符串。该实现类似于Configuration Stores - List Keys API,它返回类似于以下内容的响应:
{
"value": [
{
"id": "439AD01B4BE67DB1",
"name": "Primary",
"value": "000000000000000000000000000000000000000000000000000000",
"connectionString": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModified": "2018-04-24T16:30:54+00:00",
"readOnly": false
},
{
"id": "CB45E100456857B9",
"name": "Secondary",
"value": "000000000000000000000000000000000000000000000000000000",
"connectionString": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModified": "2018-04-24T16:30:54+00:00",
"readOnly": false
},
{
"id": "B3AC55B7E71431A9",
"name": "Primary Read Only",
"value": "000000000000000000000000000000000000000000000000000000",
"connectionString": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModified": "2018-04-24T16:30:54+00:00",
"readOnly": true
},
{
"id": "E2AF6A9A89DCC177",
"name": "Secondary Read Only",
"value": "000000000000000000000000000000000000000000000000000000",
"connectionString": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"lastModified": "2018-04-24T16:30:54+00:00",
"readOnly": true
}
]
}
由于您要访问只读连接字符串,您可以在 ARM 模板中访问它,如下所示:
"value": "[listKeys(resourceId('Microsoft.AppConfiguration/configurationStores', variables('configurationStore_name')), '2019-11-01-preview').value[2].connectionString]"
这将为您提供主只读连接字符串。同样,value[3].connectionString
将检索辅助只读连接字符串。