I am trying to create sub directories in a ProGet Asset Directory before uploading files. The documentation says Asset Directories are treated as feeds, which I can confirm through error messages (change the top level directory name to something that doesn't exist and I get the appropriate "Feed does not exist" error message). However, when I try to create the sub directory, it doesn't seem to honor the API Key, and reports instead as an anonymous user. I've tried passing the key on the URL, and setting both the X-ApiKey header, and the X-NUGET-APIKEY header.
PowerShell snippet (you'll see I'm setting it in all the ways the documentation describes - i've tried each option individually as well):
$DirectoryEndpoint = "$Server/endpoints/$AssetDirectoryName/dir/$AssetDirectoryPath" +"?key=$ApiKey"
Write-Output $DirectoryEndpoint
$headers = @{
'X-NUGET-APIKEY' = $ApiKey
'X-ApiKey' = $ApiKey
}
#Create the directory (if exists will do nothing)
Invoke-RestMethod -Method 'Post' -Uri $DirectoryEndpoint -Headers $headers -Body @{}
Results in an error message of:
Invoke-RestMethod : Anonymous is not permitted to perform the Feeds_AddPackage task for the current scope.
I've also tried adding the Anonymous user to the Admin group, and the API Key has rights to everything. I have tried replacing the API key for all headers and on the querystring to Username:Password format, but that just results in the same error.
I've checked that the headers and URL are correct and well formed by using a web proxy.
The ProGet API documentation isn't great... there aren't any example usage snippets.
Does anyone know what I'm doing wrong? Why is ProGet not identifying my API Key, or my user?