Моя цель - настроить частный канал для возможности использования моих PowerShell модулей внутри Azure Трубопроводов .
Я следовал шаг за шагом это Microsoft руководство: https://docs.microsoft.com/en-us/azure/devops/artifacts/tutorials/private-powershell-library?view=azure-devops.
Я знаю, что пакет был правильно загружен из DevOps Пользовательский интерфейс:
Следующий код (выполняется с моего компьютера разработчика) подтверждает, что и фид, и пакет находятся в действительном состоянии:
$patToken = "**************************************" | ConvertTo-SecureString -AsPlainText -Force
$credsAzureDevopsServices = New-Object System.Management.Automation.PSCredential("giacomo.stelluti@dev4side.com", $patToken)
Get-PSRepository
Find-Module -Repository PowershellAzureDevopsServices -Credential $credsAzureDevopsServices
Install-Module -Name Get-Hello -Repository PowershellAzureDevopsServices -Credential $credsAzureDevopsServices
Это вывод:
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
PowershellAzureDevopsS... Trusted https://pkgs.dev.azure.com/dev4side/Dev4side%20-%20Intranet.ai/_packaging/iai-feed/nuget/v2
Name : Get-Hello
Version : 1.0.0
Type : Module
Description : Package description
Author : dev4side
CompanyName :
Copyright : Copyright 2020 Dev4Side SRL
PublishedDate : 4/1/2020 11:28:48 AM
InstalledDate :
UpdatedDate :
LicenseUri :
ProjectUri :
IconUri :
Tags : {devtest}
Includes : {Function, RoleCapability, Command, DscResource...}
PowerShellGetFormatVersion :
ReleaseNotes : Summary of changes made in this release of the package.
Dependencies : {}
RepositorySourceLocation : https://pkgs.dev.azure.com/dev4side/Dev4side%20-%20Intranet.ai/_packaging/iai-feed/nuget/v2
Repository : PowershellAzureDevopsServices
PackageManagementProvider : NuGet
AdditionalMetadata : @{summary=Package description; releaseNotes=Summary of changes made in this release of the package.; copyright=Copyright
2020 Dev4Side SRL; tags=devtest; PackageManagementProvider=NuGet; SourceName=PowershellAzureDevopsServices;
description=Package description; created=4/1/2020 11:28:48 AM +02:00; published=4/1/2020 11:28:48 AM +02:00;
developmentDependency=False; NormalizedVersion=1.0.0; downloadCount=0; lastUpdated=4/1/2020 11:28:48 AM +02:00;
Authors=dev4side; updated=2020-04-01T09:28:48Z; isLatestVersion=True; Listed=true; IsPrerelease=false;
isAbsoluteLatestVersion=True; packageSize=15279; lastEdited=4/1/2020 11:28:48 AM +02:00; requireLicenseAcceptance=False}
Но если я попытаюсь установить модуль (используя учетную запись администратора) с:
Install-Module -Name Get-Hello -Repository PowershellAzureDevopsServices -Credential $credsAzureDevopsServices
я получу:
PackageManagement\Install-Package : Unable to resolve package source 'https://pkgs.dev.azure.com/dev4side/Dev4side -
Intranet.ai/_packaging/iai-feed/nuget/v2'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.3\PSModule.psm1:9685 char:34
+ ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (https://pkgs.de...i-feed/nuget/v2:String) [Install-Package], Exceptio
n
+ FullyQualifiedErrorId : UnableToResolveSource,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
В этой сущности есть список мои установленные модули .
Хочу добавить, что:
nuget install Get-Hello
отлично работает:
Feeds used:
https://api.nuget.org/v3/index.json
https://pkgs.dev.azure.com/dev4side/Dev4side%20-%20Intranet.ai/_packaging/iai-feed/nuget/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Installing package 'Get-Hello' to 'C:\Temp'.
GET https://api.nuget.org/v3/registration5-gz-semver2/get-hello/index.json
NotFound https://api.nuget.org/v3/registration5-gz-semver2/get-hello/index.json 529ms
GET https://pkgs.dev.azure.com/dev4side/eef92fe2-7e7f-4eb5-a62c-cc1dc2f2b440/_packaging/930b7fe7-4c85-435a-9945-733a3
0e1ea5b/nuget/v3/registrations2-semver2/get-hello/index.json
OK https://pkgs.dev.azure.com/dev4side/eef92fe2-7e7f-4eb5-a62c-cc1dc2f2b440/_packaging/930b7fe7-4c85-435a-9945-733a30
e1ea5b/nuget/v3/registrations2-semver2/get-hello/index.json 1501ms
Attempting to gather dependency information for package 'Get-Hello.1.0.0' with respect to project 'C:\Temp', targeting
'Any,Version=v0.0'
Gathering dependency information took 26.03 ms
Attempting to resolve dependencies for package 'Get-Hello.1.0.0' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Get-Hello.1.0.0'
Resolved actions to install package 'Get-Hello.1.0.0'
Retrieving package 'Get-Hello 1.0.0' from 'PowershellModules'.
Adding package 'Get-Hello.1.0.0' to folder 'C:\Temp'
Added package 'Get-Hello.1.0.0' to folder 'C:\Temp'
Successfully installed 'Get-Hello 1.0.0' to C:\Temp
Executing nuget actions took 119.62 ms
Любая помощь ДЕЙСТВИТЕЛЬНО ценится!