显示连接字符串
Display connection strings
我们已经使用部署模板设置了 Azure Web 应用程序。现在我们可以从命令行检查一些配置设置。我们如何显示当前的连接字符串?我们试过这个:
azure webapp show <resource-group> <site-name>
这只给了我们一些细节,不包括连接字符串。
Web app Name
SKU
Enabled
Last Modified
Location
Host Name
我们也尝试在 resources.azure.com 中查找,我们确实看到了那里列出的连接字符串。我们只是不知道如何通过 Azure CLI 访问它。
目前你不能。最好的是使用 -vv 选项的一些附加信息。
azure webapp show [resource-group] [name] -vv
ConnectionString 将不存在,即使 appSettings 出现在结果 json 中,无论您输入的值如何,它始终为 null。
"siteProperties":{
"metadata":null,
"properties":[],
"appSettings":null
}
如果您从 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
}
]
我们已经使用部署模板设置了 Azure Web 应用程序。现在我们可以从命令行检查一些配置设置。我们如何显示当前的连接字符串?我们试过这个:
azure webapp show <resource-group> <site-name>
这只给了我们一些细节,不包括连接字符串。
Web app Name
SKU
Enabled
Last Modified
Location
Host Name
我们也尝试在 resources.azure.com 中查找,我们确实看到了那里列出的连接字符串。我们只是不知道如何通过 Azure CLI 访问它。
目前你不能。最好的是使用 -vv 选项的一些附加信息。
azure webapp show [resource-group] [name] -vv
ConnectionString 将不存在,即使 appSettings 出现在结果 json 中,无论您输入的值如何,它始终为 null。
"siteProperties":{
"metadata":null,
"properties":[],
"appSettings":null
}
如果您从 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
}
]