Configure Tasks
Configure the following tasks for Database release.
Create Azure SQL
- Select Create Azure SQL and choose a subscription.
- Select the script path for the WebApp as shown in the image and select Ok.
- Add the script argument in the Script Argument Section. You can edit the script as required.
-resourceGroupName "$(_ResourceGroupName)" -Location "$(_Location)" -DBType "$(type)" -SQLServerName "$(SQLServerName)" -SQLUserName "$(SQLUserName)" -SQLPassword $(ConvertTo-SecureString "$(SQLPassword)" -AsPlainText -Force) -DatabaseName "$(DatabaseName)" -DatabaseSKU "$(DatabaseSKU)" - Select the Latest installed version under Azure PowerShell Version.


Azure SQL Dacpac File
- Under SQL Database, add Authentication Type, Azure SQL Server, Database, Login, Password.
- Under Deployment package, Deploy type and Action.
- Under Firewall, choose AutoDetect and select Delete Rule After Task Ends.
- Under Control Options, add the following custom condition.
and(succeeded(), eq(variables['type'], 'SQLAzure'), eq(variables['BackupSchema'], 'true'))
Upload Dacpac To Storage
- Select Upload Dacpac To Storage.
- In the script path text field, add the script path.
- Add the following script argument.
-File "$(dacpac.SqlDeploymentOutputFile)" -StorageAccountName "$(StorageAccountName)" -StorageAccountkey "$(StorageAccountkey)" -StorageContainerName "$(DBStorageContainerName)" - Select Enabled under Control Options and add the custom condition.
and(succeeded(), eq(variables['type'], 'SQLAzure'), eq(variables['BackupSchema'], 'true'))

Azure SQL Bacpac File
- Select Azure SQL Bacpac File.
- Select File format (JSON) and add **/appsettings.json in Target files text area.
- Select Enabled under Control Options and add the custom condition.
and(succeeded(), eq(variables['RestoreBuild'], 'false'))
Deploy Azure App Service Linux
- Select Deploy Azure App Service Linux.
- Choose a subscription, App type, App name, Resource group, Slot, script path for the deploy service as shown in the image.
- Select "Deploy to Slot or App Service Environment".
- Select Enabled under Control Options and add the custom condition.
and(succeeded(), eq(variables['DeployEnvironment'], 'Linux'))

Azure App Service Settings
- Select Azure App Service Settings.
- Choose a subscription, App Service name, Resource group, Slot for the Azure app service.
- Under Application and Configuration Settings > connection strings, add the following code.
[
{
"name": "DefaultConnection",
"value": "$(ConnectionStrings.DefaultConnection)",
"type": "$(type)",
"slotSetting": false
}
]

Restart Azure App Service
- Select restart Azure App Service.
- Choose a subscription, Action (Restart App Service) and App Service name for the Azure app service as shown in the image and select Save.
