Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Created March 9, 2017 21:12
Show Gist options
  • Save IlyaFinkelshteyn/fcbe7e1a3fe0f601944f1cf87c449be5 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/fcbe7e1a3fe0f601944f1cf87c449be5 to your computer and use it in GitHub Desktop.
$env:AzureDeploymentUsername = "<deployment_credentials_username>"
$env:AzureDeploymentPassword = "deployment_credentials_password"
$env:AzureWebsiteName = "<your_site_name>"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $env:AzureDeploymentUsername,$env:AzureDeploymentPassword)))
$apiUrl = "https://$env:AzureWebsiteName.scm.azurewebsites.net/api/command"
$body = @{
command="npm install"
dir="site"
}
$headers = @{
"Authorization" = ("Basic {0}" -f $base64AuthInfo)
"ContentType" = "application/json"
}
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method POST -ContentType "application/json" -Body (ConvertTo-Json $body) | fl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment