Skip to content

Instantly share code, notes, and snippets.

@GeorgDangl
Last active November 6, 2017 16:22
Show Gist options
  • Save GeorgDangl/e3e7e0462e82e09abed40bf0d8d8aacb to your computer and use it in GitHub Desktop.
Save GeorgDangl/e3e7e0462e82e09abed40bf0d8d8aacb to your computer and use it in GitHub Desktop.
Azure Functions deployment for CI environments via WebDeploy / MSDeploy
Param(
[string]$deployUsername,
[string]$deployPassword
)
$VisualStudioVersion = "15.0" # 15 == VS 2017
$msDeployPath = "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
$MsBuildPath = $(Get-ItemProperty "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7").$VisualStudioVersion + "MSBuild\15.0\Bin\MSBuild.exe"
$sourcePath = "'$PSScriptRoot/src/<ProjectFolder>/bin/Release/net461'"
& dotnet restore
& $MsBuildPath "$PSScriptRoot/src/<ProjectFolder>" /p:Configuration=Release
$msDeployPath = "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe"
$sourcePathArg = "-source:contentPath='$PSScriptRoot/src/<ProjectFolder>/bin/Release/<net461>'"
$authArg = "username='$deployUsername',password='$deployPassword',authType='basic'"
$destArg = "-dest:contentPath='<FunctionName>',computername='https://<FunctionName>.scm.azurewebsites.net:443/msdeploy.axd?site=<FunctionName>',$authArg"
& $msDeployPath -verb:sync $sourcePathArg $destArg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment