Search code examples
azureazure-deploymentazure-app-service-envrmnt

Azure app service deployment with Powershell (No FTP)


I have an ASP.NET app service running in Azure as Paas, what i wanted is simple powershell script that just deploys my ASP.NET build produced by jenkins, so just xcopy may work (No FTP).

Too many resources and options around the internet, specific input would be appreciated.


Solution

  • Thanks for the input Mike, your input ended up looking something like this with powershell script.

    #param([string]$packageFolderPath,[string]$publishProfilePath)
    
    [string]$packageFolderPath = "C:\Site"
    [string]$publishProfilePath = "C:\Publish\app-local1.PublishSettings"
    
    #Get publish-settings from file
    [xml]$xml=Get-Content($publishProfilePath)
    [string]$azureSite=$xml.publishData.publishProfile.msDeploySite.get(0)
    [string]$azureUrl=$xml.publishData.publishProfile.publishUrl.get(0)
    [string]$azureUsername=$xml.publishData.publishProfile.userName.get(0)
    [string]$azurePassword=$xml.publishData.publishProfile.userPWD.get(0)
    [string]$computerName ="`"https://$azureUrl/msdeploy.axd?site=$azureSite`""
    
    msdeploy.exe -verb:sync -source:contentPath=$packageFolderPath -dest:contentPath=$azureSite,ComputerName=$computerName,UserName=$azureUsername,Password=$azurePassword,AuthType='Basic'
    
    Write-Output "Done !"