Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save cf-rdegregory/f024c0712d5e19448138cc93cd99fdc8 to your computer and use it in GitHub Desktop.

Select an option

Save cf-rdegregory/f024c0712d5e19448138cc93cd99fdc8 to your computer and use it in GitHub Desktop.
Force an Azure App Service Web App for Containers to pull the latest manifest of a given container image tag.
<#
.SYNOPSIS
Force Azure App Service to pull the latest manifest of a given container image tag.
.EXAMPLE
PS> Update-AzAppServiceContainerImageVersion.ps1 -WebhookURL 'https://$<App Service name>:<password>@<App Service name>.scm.azurewebsites.net/api/registry/webhook'
.NOTES
https://learn.microsoft.com/en-us/azure/app-service/deploy-ci-cd-custom-container
#>
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $WebhookURL
)
$Username = $WebhookURL.Split('https://').Split(':')[1].Split('@')[0]
$Password = $WebhookURL.Split('https://').Split(':')[2].Split('@')[0]
$Headers = @{ 'Authorization' = "Basic $([Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$Username`:$Password")))" }
Invoke-RestMethod -Method Post -Uri "https://$($WebhookURL.Split('@')[1])" -Headers $Headers -UserAgent 'powershell/1.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment