显示连接字符串

时间:2016-02-16 21:59:00

标签: azure azure-cli

我们已使用部署模板设置Azure Web App。现在从命令行我们可以检查一些配置设置。我们如何显示当前的连接字符串?我们试过这个:

azure webapp show <resource-group> <site-name>

这只给我们一些细节,不包括连接字符串。

 Web app Name 
 SKU          
 Enabled      
 Last Modified
 Location     
 Host Name    

我们也尝试过查看resources.azure.com,我们看到那里列出的连接字符串。我们只是不知道如何通过Azure CLI访问它。

2 个答案:

答案 0 :(得分:2)

此刻你不能。你最好的是使用-vv选项的一些额外信息。

azure webapp show [resource-group] [name] -vv

ConnectionString将不存在,即使appSettings显示在生成的json中,无论您输入的值如何,它都将始终为 null

"siteProperties":{
  "metadata":null,
  "properties":[],
  "appSettings":null
}

答案 1 :(得分:2)

如果从ARM切换到ASM模式并使用azure site connectionstring list ...

,您可以列出连接字符串
$ azure config set mode asm
info:    Executing command config set
info:    Setting "mode" to value "asm"
info:    Changes saved
info:    config set command OK

$ azure site connectionstring list <webAppName> --json
[
  {
    "connectionString": "my super secret connection string!",
    "name": "DefaultConnection",
    "type": 2
  }
]
相关问题