我有一个ARM模板,用于使用SQL数据库部署简单的SQL Server。部署sql服务器后,我想输出数据库的connectionString。但是我得到了错误
"code":"DeploymentOutputEvaluationFailed","message":"Unable to evaluate template outputs: 'DbAdoConnString'.
请查看错误详细信息和部署操作。
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sqlserverName": {
"type": "string",
"minLength": 1,
"defaultValue": "[concat('sqlserver', uniqueString(resourceGroup().id))]"
},
"sqlserverAdminLogin": {
"type": "string",
"minLength": 1,
"defaultValue":"jimtest"
},
"sqlserverAdminLoginPassword": {
"type": "securestring",
"metadata": {
"description": "The administrator password of the SQL Server."
},
"defaultValue":"Password0123!"
},
"dbName": {
"type": "string",
"minLength": 1,
"defaultValue": "[concat('db', uniqueString(resourceGroup().id))]"
},
"dbCollation": {
"type": "string",
"minLength": 1,
"defaultValue": "SQL_Latin1_General_CP1_CI_AS"
},
"dbEdition": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"Standard",
"Premium"
]
},
"dbRequestedServiceObjectiveName": {
"type": "string",
"defaultValue": "Basic",
"allowedValues": [
"Basic",
"S0",
"S1",
"S2",
"P1",
"P2",
"P3"
],
"metadata": {
"description": "Describes the performance level for Edition"
}
}
},
"variables": {
"sqlserverName": "[parameters('sqlserverName')]",
"databaseName": "[parameters('dbName')]"
},
"resources": [
{
"name": "[variables('sqlserverName')]",
"type": "Microsoft.Sql/servers",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [ ],
"tags": {
"displayName": "sqlserver"
},
"properties": {
"administratorLogin": "[parameters('sqlserverAdminLogin')]",
"administratorLoginPassword": "[parameters('sqlserverAdminLoginPassword')]"
},
"resources": [
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallrules",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
}
},
{
"name": "[parameters('dbName')]",
"type": "databases",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', variables('sqlserverName'))]"
],
"tags": {
"displayName": "db"
},
"properties": {
"collation": "[parameters('dbCollation')]",
"edition": "[parameters('dbEdition')]",
"maxSizeBytes": "1073741824",
"requestedServiceObjectiveName": "[parameters('dbRequestedServiceObjectiveName')]"
}
}
]
}],
"outputs": {
"DbAdoConnString": {
"type": "string",
"value": "[concat('Server=tcp:',reference(parameters('yourservernameName')).fullyQualifiedDomainName,',1433;Initial Catalog=',parameters('dbnameName'),';Persist Security Info=False;User ID=',reference(parameters('yourservernameName')).administratorLogin,';Password=',reference(parameters('yourservernameName')).administratorLoginPassword,';MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;')]"
}
}
}
答案 0 :(得分:0)
尝试使用ARM模板中“ DbAdoConnString->值”中的以下值。
“ value”:“ [concat('Server = tcp:',reference(concat('Microsoft.SQL / servers /',variables('yourservernameName'))))。fullyQualifiedDomainName,',1433;初始目录=变量('YourDBName');持久安全信息= False;用户ID =',变量('administratorLogin'),'; Password =',variables('administratorLoginPassword'),'; MultipleActiveResultSets = False; Encrypt = True; TrustServerCertificate = False ; Connection Timeout = 30;')]“
答案 1 :(得分:0)