Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving error, "A parameter cannot be found that matches parameter name 'AsPlainText'." when running Get-AzKeyVaultSecret for a specific version #24829

Closed
chmaddix opened this issue May 6, 2024 · 2 comments
Assignees
Labels
customer-reported KeyVault needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@chmaddix
Copy link

chmaddix commented May 6, 2024

Description

$oldVersion.Version = anAlphaNumericVersion
$oldVersionSecret = Get-AzKeyVaultSecret -VaultName vaultName -Name secretName -Version $oldVersion.Version -AsPlainText

Above PowerShell script returns the below error:

Get-AzKeyVaultSecret : A parameter cannot be found that matches parameter name 'AsPlainText'.
At line:1 char:109

  • ... vaultName -Name secretName -Version $oldVersion.Version -AsPlainText
  •                                                          ~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Get-AzKeyVaultSecret], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret

Issue script & Debug output

$oldVersion.Version = anAlphaNumericVersion
$oldVersionSecret = Get-AzKeyVaultSecret -VaultName vaultName -Name secretName -Version $oldVersion.Version -AsPlainText



Get-AzKeyVaultSecret : A parameter cannot be found that matches parameter name 'AsPlainText'.
At line:1 char:109
+ ...  vaultName -Name secretName -Version $oldVersion.Version -AsPlainText
+                                                              ~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-AzKeyVaultSecret], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                                                                           
---------- -------    ----                                ----------------                                                                           
Script     1.7.1      Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount...}                
Script     1.5.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzK...

Error output

DEBUG: 1:54:32 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 1:54:32 PM - using account id 'alias@microsoft.com'...
WARNING: Breaking changes in the cmdlet 'Resolve-AzError' :
WARNING:  - The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` ins
tead.
 
 
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes
in Azure PowerShell.
 
 
   HistoryId: 29
 
 
ErrorCategory     : InvalidArgument: (:) [Get-AzKeyVaultSecret], ParameterBindingException
ErrorDetail       : 
InvocationInfo    : {Get-AzKeyVaultSecret}
Line              : $oldVersionSecret = Get-AzKeyVaultSecret -VaultName vaultName -Name secretName -Version $oldVersion.Version -AsPlainText
Position          : At line:1 char:109
                    + ...  vaultName -Name secretName -Version $oldVersion.Version -AsPlainText
                    +                                                              ~~~~~~~~~~~~
BoundParameters   : {}
UnboundParameters : 
HistoryId         : 29
 
Resolve-AzError : Collection was modified; enumeration operation may not execute.
At line:1 char:1
+ Resolve-AzError
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Resolve-AzError], InvalidOperationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.Errors.ResolveError
DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - False; Duration - 00:00:00.2963025; Exception - System.InvalidOperationException: Col
lection was modified; enumeration operation may not execute.
   at System.Collections.ArrayList.ArrayListEnumeratorSimple.MoveNext()
   at System.Linq.Enumerable.<OfTypeIterator>d__95`1.MoveNext()
   at Microsoft.Azure.Commands.Profile.Errors.ResolveError.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 1:54:40 PM - ResolveError end processing.
DEBUG: 1:54:40 PM - ResolveError end processing.
@chmaddix chmaddix added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 6, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 6, 2024
@isra-fel
Copy link
Member

isra-fel commented May 7, 2024

Hi, AsPlainText was introduced in a later version. Please update Azure PowerShell to the latest version.

@isra-fel isra-fel added KeyVault question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-author-feedback More information is needed from author to address the issue. and removed bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 7, 2024
@isra-fel isra-fel self-assigned this May 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the no-recent-activity There has been no recent activity on this issue. label May 14, 2024
Copy link
Contributor

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported KeyVault needs-author-feedback More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants