Skip to content

Instantly share code, notes, and snippets.

@gethari
Created November 9, 2018 11:54
Show Gist options
  • Save gethari/ec05d607f020b0fe84563e6eca1fc750 to your computer and use it in GitHub Desktop.
Save gethari/ec05d607f020b0fe84563e6eca1fc750 to your computer and use it in GitHub Desktop.
$creds = Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Web/sites/config -ResourceName $functionAppName/publishingcredentials -Action list -ApiVersion 2015-08-01 -Force
$username = $creds.Properties.PublishingUserName
$password = $creds.Properties.PublishingPassword
$filePath = ".\MIUGDemo.zip"
$apiUrl = "https://" + $functionAppName + ".scm.azurewebsites.net/api/zipdeploy"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
$userAgent = "powershell/1.0"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization = ("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method POST -InFile $filePath -ContentType "multipart/form-data"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment