Created
April 22, 2024 20:40
-
-
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.
This file contains hidden or 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
| <# | |
| .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