azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Get-AzRecoveryServicesVaultSettingsFile fails with "Unexpected character encountered while parsing value: E. Path '', line 0, position 0"

Open daalbano opened this issue 3 years ago • 18 comments

Description

The Unexpected character encountered while parsing value: E. Path '', line 0, position 0. on recent (including the latest) version of the Az.RecoveryServices powershell cmdlet fails with the exception

Unexpected character encountered while parsing value: E. Path '', line 0, position 0.

After doing some root causing and emulating the requests via PostMan seems that the API Version in use 2021-06-01 is not woking as expected, switching to the one pointed out in the documentation 2016-06-01 using the same exact request works just fine As REST API endpoint I have used the Absolute Uri printed out by the -Debug parameter added to the cmdlet in question.

Older Az.RecoveryServices versions work just fine as they use the API Version 2016-16-01

Link to the REST API documentation https://docs.microsoft.com/en-us/rest/api/recoveryservices/vault-certificates/create

Not sure if it's an issue with the api version being incorrect or if the new api version should be supported and it doesn't.

Issue script & Debug output

$recoveryVaultName = "NAME_OF_A_AZURE_SERVICES_RECOVERY_VAULT"

$certificate = New-SelfSignedCertificate `
    -CertStoreLocation Cert:\CurrentUser\My `
    -FriendlyName 'DummyRecoveryVaultCredentials' `
    -Subject "WindowsAzureTools" `
    -KeyExportPolicy Exportable `
    -NotAfter $(Get-Date).AddHours(48) `
    -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")

$certficateBase64 = [Convert]::ToBase64String($certificate.Export(
    [System.Security.Cryptography.X509Certificates.X509ContentType]::Pfx))

$vault = Get-AzRecoveryServicesVault `
    -Name $recoveryVaultName

Get-AzRecoveryServicesVaultSettingsFile `
    -Backup `
    -Vault $vault `
    -Certificate $certficateBase64 `
    -Debug

--- as a number of sensitive information are included in this very specific debug output I am not including it in its entirety ---

DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'TENANT-ID', UserId: 'USER-ID'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/Subscriptions/SUBSCRIPTION_ID/resourceGroups/ASRV_SUPPORT_REPRO_CASENUMBER_RG/providers/Microsoft.RecoveryServices/vaults/DEV-WUS2-AZURE-BACKUP-VAULT-01/certificates/DEV-WUS2-AZURE-BACKUP-VAULT-01SUBSCRIPTION_ID-12-14-2021-vaultcredentials?api-version=2021-06-01

Headers:
x-ms-client-request-id        : e47b7338-4a77-4677-99a4-1314bf45641d
accept-language               : en-US

Body:
{
  "properties": {
    "authType": "AAD",
    "certificate": "__REDACTED__BUT_VALID_BASE64__"
  }
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
x-ms-request-id               : 91b63f6d-b72a-4bc9-9861-15871add9570
x-ms-client-request-id        : e47b7338-4a77-4677-99a4-1314bf45641d,e47b7338-4a77-4677-99a4-1314bf45641d
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : 91b63f6d-b72a-4bc9-9861-15871add9570
x-ms-routing-request-id       : NORTHEUROPE:20211214T154939Z:91b63f6d-b72a-4bc9-9861-15871add9570
Cache-Control                 : no-cache
Date                          : Tue, 14 Dec 2021 15:49:39 GMT
Server                        : Microsoft-IIS/10.0

Body:
{
  "Headers": [
    {
      "Key": "Content-Type",
      "Value": [
        "text/plain; charset=utf-8"
      ]
    }
  ]
}


Confirm
Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"): a
Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
At line:19 char:1
+ Get-AzRecoveryServicesVaultSettingsFile `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzRecoveryServicesVaultSettingsFile], JsonReaderException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile

DEBUG: AzureQoSEvent: Module: Az.RecoveryServices:5.0.0; CommandName: Get-AzRecoveryServicesVaultSettingsFile; PSVersion: 5.1.19041.1320; IsSuccess: False; Duration: 00:01:14.6947593; Exception: Unexpected character encountered while parsing value: E. Path '', line 0, position 0.;   
DEBUG: Finish sending metric.
DEBUG: 15:49:43 - GetAzureRmRecoveryServicesVaultSettingsFile end processing.

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.7.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount...}
Script     5.0.0      Az.RecoveryServices                 {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Backup-AzRecoveryService...

Error output

WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
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: 11


Message        : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
StackTrace     :    at Newtonsoft.Json.JsonTextReader.ParseValue()
                    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
                    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean     
                 checkAdditionalContent)
                    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
                    at Microsoft.Azure.Commands.RecoveryServices.RecoveryServicesCmdletBase.HandleException(Exception ex)
                    at Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {Get-AzRecoveryServicesVaultSettingsFile}
Line           : Get-AzRecoveryServicesVaultSettingsFile `

Position       : At line:19 char:1
                 + Get-AzRecoveryServicesVaultSettingsFile `
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 11



   HistoryId: 8


Message        : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
StackTrace     :    at Newtonsoft.Json.JsonTextReader.ParseValue()
                    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
                    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean 
                 checkAdditionalContent)
                    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
                    at Microsoft.Azure.Commands.RecoveryServices.RecoveryServicesCmdletBase.HandleException(Exception ex)
                    at Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {Get-AzRecoveryServicesVaultSettingsFile}
Line           : Get-AzRecoveryServicesVaultSettingsFile `

Position       : At line:17 char:1
                 + Get-AzRecoveryServicesVaultSettingsFile `
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 8



   HistoryId: 1


Message        : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
StackTrace     :    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
                    at System.Reflection.Assembly.GetTypes()
                    at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)
                    at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line           :                     Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position       : At C:\Users\USER\Documents\WindowsPowerShell\Modules\Az.Accounts\2.7.0\Az.Accounts.psm1:39 char:21
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

daalbano avatar Dec 14 '21 16:12 daalbano

Thanks for reporting. We believe this inconsistency should be resolve by service side. I reply team member to look into it further.

dingmeng-xue avatar Dec 16 '21 01:12 dingmeng-xue

@daalbano I am able to reproduce this issue with the latest version of recovery services and redirecting this issue to service team for further investigation. image Thanks.

SaurabhSharma-MSFT avatar Dec 21 '21 04:12 SaurabhSharma-MSFT

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @pvrk, @adityabalaji-msft.

Issue Details

Description

The Unexpected character encountered while parsing value: E. Path '', line 0, position 0. on recent (including the latest) version of the Az.RecoveryServices powershell cmdlet fails with the exception

Unexpected character encountered while parsing value: E. Path '', line 0, position 0.

After doing some root causing and emulating the requests via PostMan seems that the API Version in use 2021-06-01 is not woking as expected, switching to the one pointed out in the documentation 2016-06-01 using the same exact request works just fine As REST API endpoint I have used the Absolute Uri printed out by the -Debug parameter added to the cmdlet in question.

Older Az.RecoveryServices versions work just fine as they use the API Version 2016-16-01

Link to the REST API documentation https://docs.microsoft.com/en-us/rest/api/recoveryservices/vault-certificates/create

Not sure if it's an issue with the api version being incorrect or if the new api version should be supported and it doesn't.

Issue script & Debug output

$recoveryVaultName = "NAME_OF_A_AZURE_SERVICES_RECOVERY_VAULT"

$certificate = New-SelfSignedCertificate `
    -CertStoreLocation Cert:\CurrentUser\My `
    -FriendlyName 'DummyRecoveryVaultCredentials' `
    -Subject "WindowsAzureTools" `
    -KeyExportPolicy Exportable `
    -NotAfter $(Get-Date).AddHours(48) `
    -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2")

$certficateBase64 = [Convert]::ToBase64String($certificate.Export(
    [System.Security.Cryptography.X509Certificates.X509ContentType]::Pfx))

$vault = Get-AzRecoveryServicesVault `
    -Name $recoveryVaultName

Get-AzRecoveryServicesVaultSettingsFile `
    -Backup `
    -Vault $vault `
    -Certificate $certficateBase64 `
    -Debug

--- as a number of sensitive information are included in this very specific debug output I am not including it in its entirety ---

DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'TENANT-ID', UserId: 'USER-ID'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/Subscriptions/SUBSCRIPTION_ID/resourceGroups/ASRV_SUPPORT_REPRO_CASENUMBER_RG/providers/Microsoft.RecoveryServices/vaults/DEV-WUS2-AZURE-BACKUP-VAULT-01/certificates/DEV-WUS2-AZURE-BACKUP-VAULT-01SUBSCRIPTION_ID-12-14-2021-vaultcredentials?api-version=2021-06-01

Headers:
x-ms-client-request-id        : e47b7338-4a77-4677-99a4-1314bf45641d
accept-language               : en-US

Body:
{
  "properties": {
    "authType": "AAD",
    "certificate": "__REDACTED__BUT_VALID_BASE64__"
  }
}


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Pragma                        : no-cache
X-Content-Type-Options        : nosniff
x-ms-request-id               : 91b63f6d-b72a-4bc9-9861-15871add9570
x-ms-client-request-id        : e47b7338-4a77-4677-99a4-1314bf45641d,e47b7338-4a77-4677-99a4-1314bf45641d
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : 91b63f6d-b72a-4bc9-9861-15871add9570
x-ms-routing-request-id       : NORTHEUROPE:20211214T154939Z:91b63f6d-b72a-4bc9-9861-15871add9570
Cache-Control                 : no-cache
Date                          : Tue, 14 Dec 2021 15:49:39 GMT
Server                        : Microsoft-IIS/10.0

Body:
{
  "Headers": [
    {
      "Key": "Content-Type",
      "Value": [
        "text/plain; charset=utf-8"
      ]
    }
  ]
}


Confirm
Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Yes"): a
Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
At line:19 char:1
+ Get-AzRecoveryServicesVaultSettingsFile `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzRecoveryServicesVaultSettingsFile], JsonReaderException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile

DEBUG: AzureQoSEvent: Module: Az.RecoveryServices:5.0.0; CommandName: Get-AzRecoveryServicesVaultSettingsFile; PSVersion: 5.1.19041.1320; IsSuccess: False; Duration: 00:01:14.6947593; Exception: Unexpected character encountered while parsing value: E. Path '', line 0, position 0.;   
DEBUG: Finish sending metric.
DEBUG: 15:49:43 - GetAzureRmRecoveryServicesVaultSettingsFile end processing.

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.7.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount...}
Script     5.0.0      Az.RecoveryServices                 {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Backup-AzRecoveryService...

Error output

WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release.  Please change any scripts that use this alias to use `Resolve-AzError` instead.
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: 11


Message        : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
StackTrace     :    at Newtonsoft.Json.JsonTextReader.ParseValue()
                    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
                    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean     
                 checkAdditionalContent)
                    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
                    at Microsoft.Azure.Commands.RecoveryServices.RecoveryServicesCmdletBase.HandleException(Exception ex)
                    at Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {Get-AzRecoveryServicesVaultSettingsFile}
Line           : Get-AzRecoveryServicesVaultSettingsFile `

Position       : At line:19 char:1
                 + Get-AzRecoveryServicesVaultSettingsFile `
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 11



   HistoryId: 8


Message        : Unexpected character encountered while parsing value: E. Path '', line 0, position 0.
StackTrace     :    at Newtonsoft.Json.JsonTextReader.ParseValue()
                    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
                    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean 
                 checkAdditionalContent)
                    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
                    at Microsoft.Azure.Commands.RecoveryServices.RecoveryServicesCmdletBase.HandleException(Exception ex)
                    at Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Newtonsoft.Json.JsonReaderException
InvocationInfo : {Get-AzRecoveryServicesVaultSettingsFile}
Line           : Get-AzRecoveryServicesVaultSettingsFile `

Position       : At line:17 char:1
                 + Get-AzRecoveryServicesVaultSettingsFile `
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 8



   HistoryId: 1


Message        : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
StackTrace     :    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
                    at System.Reflection.Assembly.GetTypes()
                    at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)
                    at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
                    at System.Management.Automation.CommandProcessorBase.Complete()
Exception      : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line           :                     Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position       : At C:\Users\USER\Documents\WindowsPowerShell\Modules\Az.Accounts\2.7.0\Az.Accounts.psm1:39 char:21
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 1


The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.
Author: daalbano
Assignees: SaurabhSharma-MSFT
Labels:

Recovery Services Backup, Service Attention, bug, question, customer-reported, CXP Attention

Milestone: -

ghost avatar Dec 21 '21 04:12 ghost

@pratimaupadhyay02 - there seems to be some issue being encountered in the newer API version. Could you take a look at this issue?

adityabalaji-msft avatar Dec 21 '21 04:12 adityabalaji-msft

@pratimaupadhyay02 Did you get a chance to look into this.

SaurabhSharma-MSFT avatar Dec 30 '21 15:12 SaurabhSharma-MSFT

I'm getting this same error with multiple commands in Az module (network, disk). A different character but the same error nonetheless.

Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

image

   > Get-Module Az.Network,Az.Compute,Az.Storage -list


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name
---------- -------    ----
Script     4.24.1     Az.Compute
Script     4.14.0     Az.Network
Script     4.3.0      Az.Storage

wsmelton avatar Mar 18 '22 01:03 wsmelton

Does anyone have a workaround for this? I'm also experiencing the same issue following microsoft documentation

image

dmetcalfe-work avatar Mar 22 '22 11:03 dmetcalfe-work

Same issue here when executing from azure automation account runbook

Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: E. Path ''

@adityabalaji-msft @SaurabhSharma-MSFT do you have any update on this?

I have attempted to follow the suggestion here but to no avail.

Using Powershell version 5.1, Az module 6.5.0, Az.RecoveryServices module = 5.2.0

hhughes0 avatar Mar 22 '22 17:03 hhughes0

Not sure if it's related, but I'm getting

Get-AzServiceBusKey : Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

Powershell version: 5.1.17763.2268 Az version: 7.3.2

parched avatar Mar 22 '22 21:03 parched

My issue was user error, I had an extra <something>/ in one of the parameters, which causes 404 and some html to be returned from the API. I assume Get-AzServiceBusKey was trying to parse this as JSON, ideally it would stop when it gets the 404 and print an error message.

@wsmelton, your issue may be similar.

parched avatar Mar 22 '22 23:03 parched

Hi, this is the regression happening in PowerShell version from Az.RecoveryServices 4.7.0 module. We have identified a bug and we plan to fix it in one of our upcoming releases.

As a workaround, could you try using the previous Az.RecoveryServices module version which is 4.6.0 or use portal to download the vault credential file. Steps to download from portal:

  1. Click on recovery services vault.
  2. Select Site Recovery Infrastructure on side blade.
  3. Select VMM servers on side blade.
  4. Click on +Server
  5. Click on Download button which is beside "Download vault registration key".

adityabalaji-msft avatar Mar 23 '22 01:03 adityabalaji-msft

Thanks @adityabalaji-msft appreciate your quick response. I have downgraded to version 4.6.0 of the Az.RecoveryServices module and this is now working as expected.

@wsmelton @dmetcalfe-work this should work for you too as a workaround. Look forward to this being fixed in newer versions.

hhughes0 avatar Mar 23 '22 09:03 hhughes0

Hi @adityabalaji-msft, thankyou for letting us know it's a known issue 👍

Do you know if there's an equivalent command for the AZ CLI or how we'd construct new vaultcredentials using the AZ CLI?

Downgrading Azure powershell across all machines will be a pain and difficult to maintain.

dmetcalfe-work avatar Mar 23 '22 15:03 dmetcalfe-work

It is not available in CLI unfortunately. Will update this thread once the issue is fixed in PS

adityabalaji-msft avatar Jul 06 '22 07:07 adityabalaji-msft

I'm on Az.RecoveryServices module version 6.1.2 and also having this problem.

> $vaultSettings = Get-AzRecoveryServicesVaultSettingsFile -SiteRecovery -Vault $rsv
Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: T. Path '', line 0,
position 0.
At line:1 char:18
+ ... tSettings = Get-AzRecoveryServicesVaultSettingsFile -SiteRecovery -Va ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzRecoveryServicesVaultSettingsFile], JsonReaderException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile

> Get-Module Az.RecoveryServices
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.1.2      Az.RecoveryServices                 {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Ba...

RyanSinfield avatar Jan 20 '23 08:01 RyanSinfield

This issue is open more than a year. With little action from Microsoft. I have updated to the lastest available and still have the issue.

skippernl avatar Feb 16 '23 08:02 skippernl

@hiaga could you please look into this

Daya-Patil avatar Jan 29 '24 03:01 Daya-Patil

Also getting this.

It is not available in CLI unfortunately. Will update this thread once the issue is fixed in PS

@adityabalaji-msft is there any forecast for when this may get fixed?

Blackbaud-PaulSebestyen avatar Feb 15 '24 15:02 Blackbaud-PaulSebestyen

Hi @Blackbaud-PaulSebestyen - I'm looking into this

are you seeing this issue in latest Az.RecoveryServices module - 6.7.1. If yes, can you please share the steps to repro this along with adding -Debug parameter in the cmdlet.

hiaga avatar Mar 21 '24 09:03 hiaga

image with a recent fix, certificate parameter is no longer required in this command and I'm able to successfully download vault cred with latest Az.RecoveryServices version - 6.7.1

Closing this issue, if the issue persists please share the debug logs and reopen this

hiaga avatar Mar 21 '24 09:03 hiaga