Last active
January 22, 2018 18:01
-
-
Save takekazuomi/75a92c7eb0f04f474b3d267ec28b0265 to your computer and use it in GitHub Desktop.
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
#Requires -Version 5.1 | |
#Requires -Modules AzureRM.Profile, AzureRM.Websites | |
[CmdletBinding()] | |
Param( | |
$ResourceGroupName, | |
$Name, | |
$Path | |
) | |
$ErrorActionPreference = "Stop" | |
$ProgressPreference='SilentlyContinue' | |
Set-StrictMode -Version latest | |
[xml]$pp = Get-AzureRmWebAppPublishingProfile -ResourceGroupName $ResourceGroupName -Name $Name -Format WebDeploy | |
$msd = $pp.publishData.publishProfile | ? { $_.publishMethod -eq 'MSDeploy' } | Select-Object -First 1 | |
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $msd.userName, $msd.userPWD))) | |
$apiUrl = "https://$webAppName.scm.azurewebsites.net/api/zipdeploy" | |
Write-Verbose "deploy $Path to $Name" -Verbose:$VerbosePreference | |
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -Method POST -InFile $Path -ContentType "multipart/form-data" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment