Last active
February 24, 2017 17:35
-
-
Save davideicardi/47ea2d1266bf73ba91bfb38306a87947 to your computer and use it in GitHub Desktop.
Deploy a website to azure using web deploy cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $deployCredentials = d3-CreateCredential | |
# d3-AzureMsDeployWebSite -deployCredentials $deployCredentials -siteName "webplu-test-distribution" -packageDeployCmd "./Deltatre.Forge.DistributionApi.deploy.cmd" | |
Function d3-AzureMsDeployWebSite | |
{ | |
param( | |
[Parameter(Mandatory = $true)] | |
[PSCredential]$deployCredentials, | |
[Parameter(Mandatory = $true)] | |
[string]$siteName, | |
[Parameter(Mandatory = $true)] | |
[string]$packageDeployCmd, | |
[switch]$delete | |
) | |
$username = $deployCredentials.Username | |
$securePassword = $deployCredentials.Password | |
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePassword) | |
$UnsecurePassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR) | |
$deleteArgs="-enableRule:DoNotDelete" | |
if ($delete){ | |
$deleteArgs="" | |
} | |
$env:_MsDeployAdditionalFlags="-setParam:name=`"IIS Web Application Name`",value=`"$siteName`" $deleteArgs" | |
& $packageDeployCmd /A:Basic "`"/M:https://$siteName.scm.azurewebsites.net:443/msdeploy.axd?site=$siteName`"" -allowUntrusted /U:$username /P:$UnsecurePassword /Y | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment