May 5, 2020 at 6:23 am #225591ParticipantTopics: 2Replies: 2Points: 28Rank: Member
I’ve been using this article Publish-Module, in my first attempt in publishing to PowerShellGallery, but been getting a 403 response indicating my key may be invalid:
Write-Error: C:\program files\powershell\7\Modules\PowerShellGet\PSModule.psm1:10946
10946 | … Publish-PSArtifactUtility @PublishPSArtifactUtility_Param …
| Failed to publish module 'Krayola': 'nuget.exe failed to push Response status code does not indicate success: 403 (The specified API key is invalid, has expired, or does not have
| permission to access the specified package.). '.
The name of my module is Krayola and my username is Plastikfan. I have created my API key, which is entitled “PlastikfanKey” and is defined with a glob pattern “Plastikfan.*”. When I set up the key, I didn’t understand the full significance of the glob pattern and I have a feeling this is what’s causing the 403 response. In the edit dialog (to edit the key on PowerShellGallery), it says under Select Packages To select which packages to associate with a key, use a glob pattern, select individual packages, or both.
So, when I publishing the module with the command:
Publish-Module -Name Krayola -NuGetApiKey
the name I have used doesn’t match the glob pattern defined for PlastikfanKey. Is this the reason why it fails?
Now, the next thing I need to know, which I can’t find an answer to is how to name my module properly.
If I want users to install my module with this command:
Does that mean that the glob pattern for PlastikfanKey should simply be ‘*’. I think it does, but I can’t be sure. On further reflection I think I would rather have my module name scoped, and I want all my modules to be consistently named.
If I wanted the user to install the module as:
Publish-Module -Name Plastikfan.Krayola -NuGetApiKey
does that mean the module directory name now has to be Plastikfan.Krayola, or can it still just be Krayola. I wouldn’t want to have use the scoped name form for the directory location, because that would look odd. Does the ‘namespace’ have to be the name of the module owner or can it be something different that the owner, ie let’s say an organisation name. What are the guidelines for this?
Normally, for these type of things I would be happy to try it out and see what happens, but I don’t want to get into the situation of having a badly published module in the gallery that I can’t remove easily. I also, can’t find enough information that describes the module name/scoping with the API key glob pattern on PowershellGallery.
PS, how do you insert code snippets on this forum? If I use “Format”-> “<> Code”, it just wraps the text in the gray background as you can see I’ve done here. But when I see other articles with full blown code samples,, it looks different, ie its a properly formatted code text block, I can’t see how to do this.
May 12, 2020 at 4:36 am #227443
- You must be logged in to reply to this topic.