Skip to content

Instantly share code, notes, and snippets.

@mikeblakeuk
Created May 27, 2020 08:58
Show Gist options
  • Save mikeblakeuk/7436c4861e363b135a492ea34c74eb66 to your computer and use it in GitHub Desktop.
Save mikeblakeuk/7436c4861e363b135a492ea34c74eb66 to your computer and use it in GitHub Desktop.
Refresh the DevOps NuGet Arifact feeds
#based on - https://dev.to/omiossec/getting-started-with-azure-devops-api-with-powershell-59nn
$feedname = "central"
$PackageName = "MyNew.Package"
$PackageVersion = "1.0.1-preview"
$AzureDevOpsPAT = "YOUR PAT" # Ideally use the az Nuget Creditials provider.
$OrganizationName = "MyOrg"
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) }
$uri = "https://pkgs.dev.azure.com/$($OrganizationName)/_apis/packaging/feeds/$($feedname)/nuget/packages/$($PackageName)/versions/$($PackageVersion)/content?api-version=5.0-preview.1"
$uri
Invoke-RestMethod -Uri $uri -Method Head -Headers $AzureDevOpsAuthenicationHeader
Invoke-RestMethod -Uri $uri -Method Get -Headers $AzureDevOpsAuthenicationHeader
@johnterickson
Copy link

Hi all! This shouldn't be needed any more. We're updating the docs to reflect greatly improved refresh speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment