Azure resource group
This template is used to create an azure deployment project. Based on a wizard, it generates file with list of console commands to perform the automatic deployment, with or without visual studio. After the project is created it can be configured and modified. Those types of projects are flexible and has a great possibility
It's a common practice to use .config files to store connectionstrings, but it's not possible to identify what content should connectionstring have after deployment. There is a separate task to change .config file after deployment. To get rid of this task azure provides a new way of using connectionstrings from .config files: they are not used at all.
Azure provides a possibility to store connectionstrings as separate settings, which are accessible in azure portal in website settings. So connectionstrings block in .config file can be empty.
Azure provides a possibility to store connectionstrings as separate settings, which are accessible in azure portal in website settings. So connectionstrings block in .config file can be empty.
Connectionstrings in deployment
There is a possibility to configure those connectionstrings in deployment project. After creation of a web project deployment new section in .json file appears. This section shown in json outline window as connectionstrings and by default contains a connectionstring to database server mentioned in the wizard. That section can be edited according to application parameters.
E.g. if.config file contains next connectionstrings:
<connectionStrings>
<add name="DbModel" connectionString="..." providerName="..." />
<add name="DbModel" connectionString="..." providerName="..." />
<add name="RedisCacheConnection" connectionString="..." />
</connectionStrings>
.json file can contains next lines:
"DbModel": {
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.
Sql/servers/', variables('sqlserverName'))). fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('databaseName'), ';User Id=', parameters(' administratorLogin'), '@', variables('sqlserverName'), ';Password=', parameters(' administratorLoginPassword'), ';')]",
"type": "SQLServer"
},
It's obvious that connectionstrings names should fit each other and application can find the correct string while executed. Connectionstring in azure deployment is dynamically built, there are two ways to see the final connectionstrings: go to azure portal and check it there or download publish profile from azure website using visual studio. That file will contain publishing information, including generated connectionstrings.
"value": "[concat('Data Source=tcp:', reference(concat('Microsoft.
"type": "SQLServer"
},
"RedisCacheConnection": {
"value": "[concat(parameters(' RetRedisCacheName'),'.redis. cache.windows.net, abortConnect=false,ssl=true')] ",
"type": "SQLServer"
}
"value": "[concat(parameters('
"type": "SQLServer"
}
Comments
Post a Comment