PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
431 stars 138 forks source link

Publish-Module return 'Key not valid for use in specified state' under the proxy #259

Closed VerdonTrigance closed 6 years ago

VerdonTrigance commented 6 years ago

I have multiple PSRepositories: PSGallery, VSTS, On-Prem. I'm going to publish my custom ps module to VSTS. I'm using same service account that run VSTS agent service which has no logonLocally permissions in domain. I enter to PSSession with that account credential to VM where agent service works. All servers under the proxy. After that I run Publish-Module... Same happening if run under VSTS agent, not PSSession.

Expected Behavior

Module is published to VSTS

Current Behavior

[tfsbuild]: PS C:\Users\dev_user\Documents> Publish-Module -Path 'C:\DeployAgent\_work\r2\a\PowerShell-dev\Modules\Deploy' -NuGetApiKey "VSTS" -Repository "VSTS" -Credential $c -Debug
DEBUG: 00:00:00.0000025 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000743 ErrorVariable: ev
DEBUG: 00:00:00.0001126 Name: VSTS
DEBUG: 00:00:00.0014827 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0027758 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0078438 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:00.0093752 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.3156923 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.3157482 ErrorVariable: ev
DEBUG: 00:00:00.3157825 Name: VSTS
DEBUG: 00:00:00.3169951 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.3182781 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.3206111 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.3274627 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.3275121 ErrorVariable: ev
DEBUG: 00:00:00.3275457 Name: VSTS
DEBUG: 00:00:00.3285166 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.3296310 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.3339508 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:04.1936768 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:04.1950337 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:04.1962842 ProviderName: PowerShellGet
DEBUG: 00:00:04.1973824 Name: VSTS
DEBUG: 00:00:04.1984803 ErrorVariable: ev
DEBUG: 00:00:04.2004720 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:04.2025981 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:04.2079450 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:04.2099176 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:04.2180040 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:04.2191844 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:04.2202922 ProviderName: PowerShellGet
DEBUG: 00:00:04.2213793 Name: VSTS
DEBUG: 00:00:04.2224573 ErrorVariable: ev
DEBUG: 00:00:04.2242865 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:04.2262353 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:04.2312549 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:04.2331824 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000030 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0001042 Verbose: False
DEBUG: 00:00:00.0001789 Name: VSTS
DEBUG: 00:00:00.0002456 ErrorVariable: ev
DEBUG: 00:00:00.0017055 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0035399 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0084153 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:00.0097562 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0195359 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0196189 Verbose: False
DEBUG: 00:00:00.0196901 Name: VSTS
DEBUG: 00:00:00.0197550 ErrorVariable: ev
DEBUG: 00:00:00.0211085 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0224587 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0247396 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0347654 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0348463 Verbose: False
DEBUG: 00:00:00.0348992 Name: VSTS
DEBUG: 00:00:00.0349344 ErrorVariable: ev
DEBUG: 00:00:00.0360968 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0373796 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0419470 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:02.7934058 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.7945540 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.7955540 ProviderName: PowerShellGet
DEBUG: 00:00:02.7965419 Verbose: False
DEBUG: 00:00:02.7975151 Name: VSTS
DEBUG: 00:00:02.7984849 ErrorVariable: ev
DEBUG: 00:00:02.8001206 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.8015600 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:02.8052624 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:02.8069174 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:02.8122069 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.8132508 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.8142472 ProviderName: PowerShellGet
DEBUG: 00:00:02.8152358 Verbose: False
DEBUG: 00:00:02.8162014 Name: VSTS
DEBUG: 00:00:02.8172799 ErrorVariable: ev
DEBUG: 00:00:02.8192668 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.8205216 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:02.8240440 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:02.8257396 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000023 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000669 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0001049 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0001385 Source: VSTS
DEBUG: 00:00:00.0001722 Debug: True
DEBUG: 00:00:00.0002049 Verbose: False
DEBUG: 00:00:00.0002387 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0002723 Name: Deploy
DEBUG: 00:00:00.0013784 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0025145 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0067670 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:00.0079139 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0151069 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0151575 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0151935 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0152270 Source: VSTS
DEBUG: 00:00:00.0152600 Debug: True
DEBUG: 00:00:00.0152925 Verbose: False
DEBUG: 00:00:00.0153263 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0153590 Name: Deploy
DEBUG: 00:00:00.0163161 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0174251 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0193727 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0268106 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0268644 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0269003 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0269328 Source: VSTS
DEBUG: 00:00:00.0269657 Debug: True
DEBUG: 00:00:00.0269977 Verbose: False
DEBUG: 00:00:00.0270317 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0270631 Name: Deploy
DEBUG: 00:00:00.0279805 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0290578 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0331993 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0409701 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0410223 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0410580 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0410904 Source: VSTS
DEBUG: 00:00:00.0411229 Debug: True
DEBUG: 00:00:00.0411550 Verbose: False
DEBUG: 00:00:00.0411885 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0412189 Name: Deploy
DEBUG: 00:00:00.0421250 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0431507 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0514471 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:02.5930613 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.5943024 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.5954232 WarningAction: SilentlyContinue
DEBUG: 00:00:02.5965144 Type: Script
DEBUG: 00:00:02.5975932 Source: VSTS
DEBUG: 00:00:02.5987795 Debug: True
DEBUG: 00:00:02.5999280 Name: Deploy
DEBUG: 00:00:02.6010059 Tag: PSScript
DEBUG: 00:00:02.6022244 ProviderName: PowerShellGet
DEBUG: 00:00:02.6033050 Verbose: False
DEBUG: 00:00:02.6043935 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:02.6054550 AllowPrereleaseVersions: True
DEBUG: 00:00:02.6065225 ErrorAction: SilentlyContinue
DEBUG: 00:00:02.6083703 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.6100834 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:02.6157633 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:02.6180916 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:02.6184686 Calling SearchForPackages. Name='Deploy'
DEBUG: 00:00:02.6206973 PackageProvider::FindPackage with name Deploy
DEBUG: 00:00:02.6215067 Calling SearchForPackages After Select 1
DEBUG: 00:00:02.6275929 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:02.6287577 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.6298797 WarningAction: SilentlyContinue
DEBUG: 00:00:02.6309747 Type: Script
DEBUG: 00:00:02.6320609 Source: VSTS
DEBUG: 00:00:02.6332872 Debug: True
DEBUG: 00:00:02.6344604 Name: Deploy
DEBUG: 00:00:02.6356007 Tag: PSScript
DEBUG: 00:00:02.6367540 ProviderName: PowerShellGet
DEBUG: 00:00:02.6378958 Verbose: False
DEBUG: 00:00:02.6390207 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:02.6402646 AllowPrereleaseVersions: True
DEBUG: 00:00:02.6416242 ErrorAction: SilentlyContinue
DEBUG: 00:00:02.6435841 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:02.6453782 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:02.6465571 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.6477244 OPTION: WarningAction => SilentlyContinue
DEBUG: 00:00:02.6489603 OPTION: Type => Script
DEBUG: 00:00:02.6500957 OPTION: Source => VSTS
DEBUG: 00:00:02.6512646 OPTION: Debug => True
DEBUG: 00:00:02.6523965 OPTION: Name => Deploy
DEBUG: 00:00:02.6535543 OPTION: Tag => PSScript
DEBUG: 00:00:02.6546828 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:02.6557880 OPTION: Verbose => False
DEBUG: 00:00:02.6568792 OPTION: Credential => System.Management.Automation.PSCredential
DEBUG: 00:00:02.6579809 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:02.6590691 OPTION: ErrorAction => SilentlyContinue
DEBUG: 00:00:02.6721936 PackageProvider::FindPackage with name Deploy
DEBUG: 00:00:02.6787714 Calling 'NuGet'::'FindPackage' - name='Deploy', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:02.6805475 Iterating 'Deploy'.
DEBUG: 00:00:02.6824818 There are '2' registered sources in 'NuGet' provider.
DEBUG: 00:00:02.6840169 Calling 'NuGetRequest'::'GetPackageById', 'Deploy'.
DEBUG: 00:00:02.6854860 Calling 'HttpClientPackageRepository'::'FindPackagesById', 'Deploy'.
DEBUG: 00:00:02.6869441 Calling 'NuGetClient'::'FindPackage'.
DEBUG: 00:00:02.6893395 Downloading 'https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2/FindPackagesById()?id='Deploy'&$skip=0&$top=40'.
DEBUG: 00:00:05.8733224 Completed iterating for 'Deploy'.
DEBUG: 00:00:05.8747965 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:05.8765476 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:05.8777816 unmatched package name='Deploy'
DEBUG: 00:00:00.0000022 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000665 Verbose: False
DEBUG: 00:00:00.0001160 Name: VSTS
DEBUG: 00:00:00.0001506 ErrorVariable: ev
DEBUG: 00:00:00.0013649 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0025229 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0073281 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:00.0085567 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0833087 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0833659 Verbose: False
DEBUG: 00:00:00.0834015 Name: VSTS
DEBUG: 00:00:00.0834360 ErrorVariable: ev
DEBUG: 00:00:00.0847025 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0865839 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0888846 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0961041 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0961578 Verbose: False
DEBUG: 00:00:00.0961922 Name: VSTS
DEBUG: 00:00:00.0962251 ErrorVariable: ev
DEBUG: 00:00:00.0972199 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0983656 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.1031879 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:01.7944599 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:01.7958256 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.7969767 ProviderName: PowerShellGet
DEBUG: 00:00:01.7981190 Verbose: False
DEBUG: 00:00:01.7992612 Name: VSTS
DEBUG: 00:00:01.8003834 ErrorVariable: ev
DEBUG: 00:00:01.8024123 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:01.8044777 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:01.8103644 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:01.8124733 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:01.8206827 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:01.8218897 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.8231002 ProviderName: PowerShellGet
DEBUG: 00:00:01.8243976 Verbose: False
DEBUG: 00:00:01.8255231 Name: VSTS
DEBUG: 00:00:01.8266473 ErrorVariable: ev
DEBUG: 00:00:01.8282445 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:01.8299086 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:01.8356698 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:01.8379434 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000023 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000740 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0001198 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0001560 Source: VSTS
DEBUG: 00:00:00.0001921 Debug: True
DEBUG: 00:00:00.0002276 Verbose: False
DEBUG: 00:00:00.0002638 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0002995 Name: Deploy
DEBUG: 00:00:00.0017029 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0030617 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0079160 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:00.0092708 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0174340 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0174945 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0175330 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0175690 Source: VSTS
DEBUG: 00:00:00.0176037 Debug: True
DEBUG: 00:00:00.0176375 Verbose: False
DEBUG: 00:00:00.0176729 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0177044 Name: Deploy
DEBUG: 00:00:00.0187514 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0199433 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0220288 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0306239 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0306835 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0307218 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0307557 Source: VSTS
DEBUG: 00:00:00.0307904 Debug: True
DEBUG: 00:00:00.0308253 Verbose: False
DEBUG: 00:00:00.0308604 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0308921 Name: Deploy
DEBUG: 00:00:00.0319770 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0332144 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0384282 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0456094 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0456678 ErrorAction: SilentlyContinue
DEBUG: 00:00:00.0457046 WarningAction: SilentlyContinue
DEBUG: 00:00:00.0457382 Source: VSTS
DEBUG: 00:00:00.0457715 Debug: True
DEBUG: 00:00:00.0458040 Verbose: False
DEBUG: 00:00:00.0458386 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:00.0458695 Name: Deploy
DEBUG: 00:00:00.0469629 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0482316 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0577394 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:01.2728565 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:01.2743850 ProviderName: PowerShellGet
DEBUG: 00:00:01.2756188 WarningAction: SilentlyContinue
DEBUG: 00:00:01.2767328 Type: Module
DEBUG: 00:00:01.2778348 Source: VSTS
DEBUG: 00:00:01.2789419 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.2800538 Name: Deploy
DEBUG: 00:00:01.2811439 Debug: True
DEBUG: 00:00:01.2822335 Verbose: False
DEBUG: 00:00:01.2833018 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:01.2843950 AllowPrereleaseVersions: True
DEBUG: 00:00:01.2855091 ErrorAction: SilentlyContinue
DEBUG: 00:00:01.2880193 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:01.2903713 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:01.2987165 Yielding package source for VSTS at location https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2
DEBUG: 00:00:01.3010944 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:01.3016063 Calling SearchForPackages. Name='Deploy'
DEBUG: 00:00:01.3039846 PackageProvider::FindPackage with name Deploy
DEBUG: 00:00:01.3050479 Calling SearchForPackages After Select 1
DEBUG: 00:00:01.3146369 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:01.3158168 ProviderName: PowerShellGet
DEBUG: 00:00:01.3169953 WarningAction: SilentlyContinue
DEBUG: 00:00:01.3182134 Type: Module
DEBUG: 00:00:01.3193720 Source: VSTS
DEBUG: 00:00:01.3213758 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.3225017 Name: Deploy
DEBUG: 00:00:01.3236049 Debug: True
DEBUG: 00:00:01.3246527 Verbose: False
DEBUG: 00:00:01.3257041 Credential: System.Management.Automation.PSCredential
DEBUG: 00:00:01.3267601 AllowPrereleaseVersions: True
DEBUG: 00:00:01.3278063 ErrorAction: SilentlyContinue
DEBUG: 00:00:01.3295805 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:01.3312798 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:01.3323629 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:01.3334058 OPTION: WarningAction => SilentlyContinue
DEBUG: 00:00:01.3344475 OPTION: Type => Module
DEBUG: 00:00:01.3356884 OPTION: Source => VSTS
DEBUG: 00:00:01.3368945 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.3379664 OPTION: Name => Deploy
DEBUG: 00:00:01.3390053 OPTION: Debug => True
DEBUG: 00:00:01.3402600 OPTION: Verbose => False
DEBUG: 00:00:01.3412917 OPTION: Credential => System.Management.Automation.PSCredential
DEBUG: 00:00:01.3423242 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:01.3433462 OPTION: ErrorAction => SilentlyContinue
DEBUG: 00:00:01.3534737 PackageProvider::FindPackage with name Deploy
DEBUG: 00:00:01.3595632 Calling 'NuGet'::'FindPackage' - name='Deploy', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:01.3610818 Iterating 'Deploy'.
DEBUG: 00:00:01.3628728 There are '2' registered sources in 'NuGet' provider.
DEBUG: 00:00:01.3643503 Calling 'NuGetRequest'::'GetPackageById', 'Deploy'.
DEBUG: 00:00:01.3657696 Calling 'HttpClientPackageRepository'::'FindPackagesById', 'Deploy'.
DEBUG: 00:00:01.3674814 Calling 'NuGetClient'::'FindPackage'.
DEBUG: 00:00:01.3698396 Downloading 'https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2/FindPackagesById()?id='Deploy'&$skip=0&$top=40'.
DEBUG: 00:00:04.4348572 Completed iterating for 'Deploy'.
DEBUG: 00:00:04.4361972 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:04.5222827 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:04.5239241 unmatched package name='Deploy'
Publish-PSArtifactUtility : Failed to publish module 'Deploy': 'Key not valid for use in specified state.
'.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.6.0\PSModule.psm1:1447 char:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

Possible Solution

Add -Proxy param to Publish-Module ?

Steps to Reproduce (for bugs)

  1. Register VSTS PSRepository
  2. Add NuGet Source to VSTS
  3. Publish-Module as above
  4. Get error

Context

Trying to publish custom module that have nested extrenal modules (like SqlServer as above).

Your Environment


[tfsbuild]: PS C:\Users\dev_user\Documents> $PSVersionTable

Name                           Value                                                                                                                                                       
----                           -----                                                                                                                                                       
PSVersion                      5.1.14409.1005                                                                                                                                              
PSEdition                      Desktop                                                                                                                                                     
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                     
BuildVersion                   10.0.14409.1005                                                                                                                                             
CLRVersion                     4.0.30319.42000                                                                                                                                             
WSManStackVersion              3.0                                                                                                                                                         
PSRemotingProtocolVersion      2.3                                                                                                                                                         
SerializationVersion           1.1.0.1 

[tfsbuild]: PS C:\Users\dev_user\Documents> Get-Module

ModuleType Version    Name                                ExportedCommands                                                                                                                 
---------- -------    ----                                ----------------                                                                                                                 
Script     1.0        GroupSet                            {BuildResourceCommonParameters, BuildResourceString, GroupSet}                                                                   
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                               
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}                                        
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                                        
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}                                                  
Script     1.1.7.0    PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package, Get-PackageProvider...}                                                        
Script     1.6.0      PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability...}                                                            
Script     1.0        ProcessSet                          {BuildResourceCommonParameters, BuildResourceString, ProcessSet}                                                                 
Manifest   1.1        PSDesiredStateConfiguration         {Invoke-DscResource, Publish-DscConfiguration, Set-DscLocalConfigurationManager, Start-DscConfiguration...}                      
Script     1.0        ServiceSet                          {BuildResourceCommonParameters, BuildResourceString, ServiceSet}                                                                 
Script     1.0        WindowsFeatureSet                   {BuildResourceCommonParameters, BuildResourceString, WindowsFeatureSet}                                                          
Script     1.0        WindowsOptionalFeatureSet           {BuildResourceCommonParameters, BuildResourceString, WindowsOptionalFeatureSet}                                                  

[tfsbuild]: PS C:\Users\dev_user\Documents> Get-Module -ListAvailable PowerShellGet,PackageManagement

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands                                                                                                                 
---------- -------    ----                                ----------------                                                                                                                 
Script     1.1.7.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                           
Script     1.1.3.0    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                           
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                                           
Script     1.6.0      PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                                                     
Script     1.1.2.0    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                                                     
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}    

[tfsbuild]: PS C:\Users\dev_user\Documents> Get-PackageProvider

Name                     Version          DynamicOptions                                                                                                                                   
----                     -------          --------------                                                                                                                                   
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, Sk...
msi                      3.0.0.0          AdditionalArguments                                                                                                                              
msu                      3.0.0.0                                                                                                                                                           
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate          
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, I...
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent     

[tfsbuild]: PS C:\Users\dev_user\Documents> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions                                                                                                                                   
----                     -------          --------------                                                                                                                                   
Chocolatey               2.8.5.130        SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, Sk...
msi                      3.0.0.0          AdditionalArguments                                                                                                                              
msu                      3.0.0.0                                                                                                                                                           
nuget                    2.8.5.208                                                                                                                                                         
NuGet                    2.8.5.210        Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, SkipValidate          
PowerShellGet            1.6.0.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersions, Filter, Tag, I...
PowerShellGet            1.1.2.0                                                                                                                                                           
PowerShellGet            1.0.0.1                                                                                                                                                           
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent 

[tfsbuild]: PS C:\Users\dev_user\Documents> Get-PackageSource

Name                             ProviderName     IsTrusted  Location                                                                                                                      
----                             ------------     ---------  --------                                                                                                                      
chocolatey                       Chocolatey       False      http://chocolatey.org/api/v2/                                                                                                 
nuget.org                        NuGet            False      https://api.nuget.org/v3/index.json                                                                                           
VSTS                             NuGet            True       https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2                                         
OnPrem                           PowerShellGet    False      http://onprem:8080/nuget/                                                                                    
PSGallery                        PowerShellGet    True       https://www.powershellgallery.com/api/v2/                                                                                     
VSTS                             PowerShellGet    True       https://x.pkgs.visualstudio.com/_packaging/TFSOnlinePackages/nuget/v2                                         
bmanikm commented 6 years ago

@VerdonTrigance The reported error is from NuGet.exe. Please take a look at https://stackoverflow.com/questions/29395683/nuget-with-artifactory-key-not-valid-for-use-in-specified-state.

VerdonTrigance commented 6 years ago

@bmanikm Thank you. I will check it soon.

VerdonTrigance commented 6 years ago

@bmanikm Trully, I reenter nuget.exe config -set http.proxy.password=Pass and error is gone. Thank you.