Is your feature request related to a problem? Please describe.
I cannot create a new artifacts feed from CLI
Describe the solution you'd like
az artifacts feed create --name 'MyName'
This would create a new artifacts feed with default settings for Visibility and "Packages from public sources". Parameters for those settings is a bonus
Additional context
I need to automate as much as possible, but right now I cannot create new feeds from the script.
Adding @elbatk (Artifacts PM)
Hi @jwikman , what are you trying to automate? In my mind, feeds aren't something that should need to be created in scripts.
@elbatk we've got a lot of small apps being created. All apps will use a few pipelines and publish to an artifact feed.
I want to keep the naming consistent and help our developers to have everything setup as much as possible for each app: Repository (with template code), pipelines, artifact feeds etc. I use PowerShell and az CLI to script all this.
In this way we know that the feeds will follow our naming conventions. As an example it will make it much easier for us when dealing with dependencies between apps when we want to download the universal packages.
Have you looked into our Create Feeds API? Would that work here?
It probably would, but then I have to add the authentication pieces for the API. I've managed without going directly to the API so far...
Having this in the az CLI would (obviously) make things easier...
Got it - I'll add the feature to our backlog under an umbrella of Azure Artifacts under Azure CLI improvements.
For my curiously, how often are you doing this and how many are you creating?
Thanks.
I'm not bulk inserting feeds, it's more about consistency. Maybe a couple a week or so, but more to start with when we create feeds for all existing apps.
Seems like a very reasonable scenario to me.
@jwikman happy to help with API auth in the meantime if you're interested. I think our docs on that could also likely use some improvement, to say the least.
I haven't dived into the details of the API auth, but from what I've seen it's not really straight forward. ;-)
So any help would be appreciated. It would be great if I somehow could use the auth token from the az login so I don't need to authenticate twice.
Honestly, the easiest method is probably to generate an Azure DevOps Personal Access Token and use that. Make the API request with an Authorization header with Basic scheme where the username is anything and the password is the token (note that per the Basic scheme you have to base64 encode the username:password). So you'll have a header that looks like e.g. Authorization: Basic YXp1cmVkZXZvcHM6bXl0b2tlbmdvZXNoZXJl.
That said, if using a PAT doesn't fit your requirements for some reason, there are other options but they're trickier / not as well supported.
Azure CLI tokens are stored in ~/.azure/accessTokens.json. Note that these are tokens generated by Azure Active Directory (AAD) rather than generated by Azure DevOps, so they have different characteristics in terms of validity, although they are accepted by Azure DevOps. So you could extract a token from there and use it if you really wanted.
Thanks @zarenner,
I've now got it working in PowerShell with both PAT and the token in accesTokens.json. Will have to think a bit about what's best in the long run...
Anyway, thanks for pointing me in the right direction!
Hi again @zarenner ,
Now I come to the point where I was about to publish to the feed created through the API. But it seems as if I cannot create a feed with Universal Packages capability?
When I tried to publish some artifacts as Universal Packages I received an error "The feed with ID 'MyFeedName' doesn't exist".
When checking in the UI I clearly see my new feed, but when clicking on "Connect to feed" I see no "Universal Packages" tab as I do when I created the feeds manually in the UI...
I know that this is not the repo for the API, but maybe you could help me out here or point me in the right direction?
This is also very important to support when you are implementing the "az artifacts feed create" feature. We must also be able to create a feed that supports Universal packages.
I appreciate your help!
@jwikman in general feeds are not package-type specific, but currently there is a limitation where Universal Packages is not available for project-associated feeds. That is, if you created the feed using a URL that the project in it, Universal Packages will not work.
Doesn't currently support Universal Packages:
https://feeds.dev.azure.com/{organization}/{project}/_apis/packaging/feeds
Does support Universal Packages:
https://feeds.dev.azure.com/{organization}/_apis/packaging/feeds
If this isn't your issue, please let me know - there shouldn't be any other reason why feeds don't support Universal Packages.
@pspill is going to update the docs to clarify this. Thanks Peter.
Thanks, @zarenner! That was my issue!
I had only created feeds for one project yet, so I hadn't noticed that those where shared among all projects... Well I hope that Universal Packages will be enabled in project-associated feeds someday.
Thanks! (again)
Hey @jwikman , glad we could get you going on this. I do believe you can use Universal packages with project-scoped feeds now (private, not public due to some technical constraints). You will likely need the latest version of the Azure CLI to do it (I know, we just told you to use the REST API for something else, sorry about the combo). Going to close this one as we're tracking it on the backlog (creating feeds via CLI)
Just found out that the latest CLI doesn't have it, but the next version will, hopefully releasing soon :)
Thanks @elbatk
I will check that out when it's released. 馃憤
@elbatk So if I'm understanding the current state of affairs... the UI in Azure DevOps only creates project scoped feeds now, but the CLI doesn't support uploading Universal Packages to those feeds? Am I getting that correctly?
Thus the net of the situation is that you can't currently build pipelines that publish artifacts to feeds without either 1) going against the MS recommendation and creating an organization scoped feed or 2) hacking a REST call into the pipeline to do the publish. Are those the options we're down to?
@mark4code A new version of the Azure DevOps extension for the the CLI has been released that supports publishing to and downloading from project scoped feeds. You can update your extension with az extension update --name azure-devops. Also see here.
Users browsing a project-scoped feed in the UI will see a callout on the "Connect to Feed - Universal" page that warns them to upgrade to extension version 0.14.0 or greater, and the instructions there show the correct project parameters to use with the CLI.
@pspill Then is the remaining gap on the Universal Packages task within the Azure DevOps plugins? I had thought that once the CLI supported the functionality that the task would have inherited that enhancement, but it appears that the Universal package task fails when attempting to publish to a project scoped feed.
Also, (sorry if it's a little off topic) is the Azure Atrifacts team working on an API that will allow for download of the artifact via REST calls? It seems like using the CLI tool that downloads an EXE that seems to do a LOT of stuff behind the scenes is presently the only way to get a Universal artifact back out of a repo, which severely limits the usefulness of using Azure artifacts for them.
Is this available in the cli today ?