Can i add publish setting file from VSTS to deploy project on Microsoft azure - azure-pipelines-release-pipeline

i am trying to deploy the project from VSTS to azure i have publish setting file i need to know how to use publish setting file in pipeline to deploy the project on azure. or any other solution to deploy on azure.

Yes, you can store the plain password in the secret variable of build/release, then specify the password through MSBuild argument (/p:Password={variable}).
After that you can specify the public profile (.pubxml file instead of .publishsettings file) in Visual Studio Build task (e.g. /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:PublishProfile="{profile name}")
Alternately you can write a script and add a Batch Script task to run the script to deploy on Azure. Please refer to Deploying to Azure from VSTS using publish profiles and msdeploy for details.
You can also use the Azure App Service Deploy task to deploy the Azure Web App. Please refer to How to deploy to Azure using Team Services Release Management for details.

Related

Executing mysql scripts tasks on (on-premise linux agent) mysql server using Azure DevOps Release pipeline?

I have configured Azure Release pipeline for my deployment. But I want to run Mysql scripts on Mysql Sever using azure devops tasks, can someone help me if there is a best way to run the scripts ?
0- what task should I use from azure marketplace ?
1- should I run all scripts in one task or each script as a separate task ?
2- how to wait while script is running ?
MySQL Toolkit for Windows is a VSTS / TFS extension and contains helpful tasks for build and release definition for MySQL servers. You can run ad-hoc MySQL command, script or scripts collection on Windows Agents including Windows Hosted Agents (Linux Agents not supported).
In addition, you can add a step to run a PowerShell/batch script to execute the SQL script, and you can also create a custom build task and publish it to VSTS.
BTW, you could add PowerShell Sleep function to wait while script is running.
Update>>You could use Copy Files task to copy files from a source folder to a target folder using match patterns.

Azure DevOps - How to download a file from repo using SSIS

I am looking to create a SSIS package which downloads a file from an Azure DevOps GIT repository.
The file is a excel spread sheet.
The SSIS package should download this file in a local directory which can then be used for further processing.
Is this possible to achieve using SSIS?
Is this possible to achieve using SSIS?
I'm afraid, no, this could not be achieved via SSIS until now. Because what is available in Azure devops is build and deploy SSIS package. We haven't support to run SSIS package in Azure devops pipeline at this time.
At present, you can make use Azure Data Factory, which is the one service of Azure. See this doc.
But also, as far as I know, it does not support activity of copy file via SSIS. And if you want the excel file can be further processing with SSIS, you may consider to use Azure file copy task to copy the excel file to Azure blob:
You can do just about anything you want in Azure Devops using either the Powershell release template or the Run Powershell on Remote Machines release template. The only catch here is setting up WinRM on the remote servers, opening ports/firewall settings, using X509 self-signed certs if you want to do this over SSL, WinRM listeners, setting up trusted hosts, etc. etc. It took me two months to finally get WinRM setup and working correctly from Azure Devops (in my case that included setting up a special security group policy to allow the WinRM services to run unimpeded on the remote machines joined to the domain). Once you have WinRM working though, you can have Azure Devops drive anything that you could script with Powershell so the effort was worth it for me. If you embark on this adventure, take the time to write some powershell test scripts that call Invoke-command to test all of the WinRM security features I mention above, this will save you a lot of time with troubleshooting a remote connection over WinRM.

Remove App Settings During Azure App Service Deployment

Deploying via Azure Release Pipeline - and in our Deploy Azure App Service step, we set App Service's Application Settings via the
.
Our contingency if the deployment fails, is redeploy an old release (months old) to the same app-service.
However, we need to delete some of the App Service's Application Settings that were set. Just removing these in the old release pipeline does not remove them from the App Service Configuration App Settings section.
Now we don't have the luxury of deleting these app-settings manually on the App Service Configuration.
So what is the recommended way to achieve this through the pipeline?
Remove App Settings During Azure App Service Deployment
You could use the Azure CLI task in the pipeline to delete appsettings, like:
az webapp config appsettings delete --name MyWebApp --resource-group MyResourceGroup --setting-names {setting-names}
Check the az webapp config appsettings delete for some more details.
On the other hard, you also could use API Web Apps - Update Application Settings to delete application settings.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/appsettings?api-version=2016-08-01
You can check the answer here.
Hope this helps.

Using VSTS with multiple Azure Environments

We are new to VSTS and will be using the online service and integrating with our production Azure AD tenant. Since we do development that involves Office 365, this meant that we have both production and development Office 365/Azure AD environments. We understand that our authentication can only be tied to one of these (which is fine) but can we use VSTS to perform tasks against both environments (e.g. staging, deploy, etc.)? Are there certain things that do/don't work we should consider or are there other suggestions on how we would leverage VSTS across these environments as we take code tested against development to production? Thanks!
One option to do this would be using powershell and service principal authentication. No point in copy\pasting documentation so I'll leave a link.
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authenticate-service-principal
You can also just authenticate to the API, get oAuth token and do pretty much anything with that. Not super straight forward, but can be done ;)
You can add multiple azure service endpoints, then deploy app through release, simple steps:
Refer to this blog: Automating Azure Resource Group deployment using a Service Principal in Visual Studio Online to manual configure Azure service endpoint (Manual Configuration section)
Create a Release Definition in vsts
Add environments (e.g. Staging, Deploy)
Add Azure App Service Deployment task for each environment
Specify corresponding Azure Subscription for these tasks

Integrating KeyVault access into VSTS Release task

I am trying to figure out what is involved to write a console application that will run as part of a VSTS Release task and that program will read a connection string (secret) from a preconfigured keyvault and then connect to an Azure SQL db using that connection string and apply some changes.
Currently I have my Web Apps connecting to KeyVault and the Azure SQL Server
using Azure AD Application Token authentication so I know what is involved on that front.
When you check "Allow scripts to access OAuth token" on agent settings page,
can this token be used (using ADAL) to connect to KeyVault and SQL Server.
(Assuming the VisualStudioSPNxxx has the appropriate access to the above resources).
If not what should I be looking for?
The vsts token (Allow scripts to access OAuth token) can’t be used to connect to KeyVault.
You need to register app with Azure Active Directory and enable to communicate with Azure Active Directory and Key Vault, then get the connectionstring dynamically.
More information, you can refer to: Protecting Secrets using VSTS and Azure Key Vault
This is made relatively very easy now with Variable Groups - https://learn.microsoft.com/en-us/vsts/pipelines/library/variable-groups?view=vsts
You can link a secret by connecting your Azure KV to a variable and then use this variable as you would normally use it in any script/task.