Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: T. Path '', line 0, position 0.
Description
Get-AzRecoveryServicesVaultSettingsFile throws an error when trying to retrieve vault credentials for for an ASR vault. The help file and other documentation is also incomplete. When following the example given in get-help an error is thrown saying there are missing parameters. When using all required parameters referenced in help file you get the Unexpected Character error mentioned in the title. The -Certificate parameter has no description of what certificate is required to be referenced. It simply says -Certificate <System.String> {{Fill Certificate Description}}
Script/Steps for Reproduction
Get-AzRecoveryServicesVaultSettingsFile -Vault $vault -SiteRecovery -SiteFriendlyName $siteName -SiteIdentifier $siteIdentifier -Certificate $cert
Module Version
Get-Module -ListAvailable
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.1.0 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}
Script 1.0.0 Az.Aks {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script 1.0.0 Az.AnalysisServices {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer...}
Script 1.0.0 Az.ApiManagement {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementCustomHostnameConfiguration, New-AzApiManagementSystemCertificate...}
Script 1.0.0 Az.ApplicationInsights {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplicationInsightsPricingPlan...}
Script 1.0.0 Az.Automation {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration...}
Script 1.0.0 Az.Batch {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeys, New-AzBatchAccount...}
Script 1.0.0 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget...}
Script 1.0.0 Az.Cdn {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script 1.0.0 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccountSkus, Get-AzCognitiveServicesAccountType...}
Script 1.1.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet...}
Script 1.0.0 Az.ContainerInstance {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script 1.0.0 Az.ContainerRegistry {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry...}
Script 1.0.0 Az.DataFactory {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}
Script 1.0.0 Az.DataLakeAnalytics {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogCredential, Set-AzDataLakeAnalyticsCatalogCredential...}
Script 1.0.1 Az.DataLakeStore {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirewallRule, Set-AzDataLakeStoreTrustedIdProvider...}
Script 1.0.0 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}
Script 1.0.0 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script 1.1.0 Az.EventGrid {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}
Script 1.0.0 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubNamespace...}
Script 1.0.0 Az.HDInsight {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapReduceJobDefinition...}
Script 1.0.1 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJob...}
Script 1.0.0 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation...}
Script 1.1.0 Az.LogicApp {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountCallbackUrl, Get-AzIntegrationAccountCertificate, Get-AzIntegrationAccount...}
Script 1.0.0 Az.MachineLearning {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistory, Remove-AzMlCommitmentPlan...}
Script 1.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.0.0 Az.Media {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMediaServiceKeys, Get-AzMediaServiceNameAvailability...}
Script 1.0.0 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script 1.0.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-AzApplicationGatewayAuthenticationCertificate, Remove-AzApplicationGatewayAuthenticationCertificate...}
Script 1.0.0 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, Get-AzNotificationHubListKeys, Get-AzNotificationHubPNSCredentials...}
Script 1.0.0 Az.OperationalInsights {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsightsIISLogCollection...}
Script 1.0.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}
Script 1.0.0 Az.PowerBIEmbedded {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAccessKeys, Get-AzPowerBIWorkspace...}
Script 1.0.0 Az.RecoveryServices {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSettingsFile, New-AzRecoveryServicesVault...}
Script 1.0.0 Az.RedisCache {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedisCachePatchSchedule...}
Script 1.0.0 Az.Relay {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}
Script 1.1.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}
Script 1.0.0 Az.ServiceBus {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamespace...}
Script 1.0.0 Az.ServiceFabric {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode...}
Script 1.0.1 Az.SignalR {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script 1.0.1 Az.Sql {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseUpgradeHint...}
Script 1.0.1 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey...}
Script 1.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFunction, Remove-AzStreamAnalyticsFunction...}
Script 1.0.0 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Remove-AzTrafficManagerCustomHeaderFromProfile...}
Script 1.0.1 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}
Environment Data
PS C:\Windows\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.16299.785
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.785
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Debug Output
PS C:\Windows\system32> Get-AzRecoveryServicesVaultSettingsFile -Vault $vault -SiteRecovery -SiteFriendlyName $siteName -SiteIdentifier $siteIdentifier -Certificate $cert
DEBUG: 4:00:36 PM - GetAzureRmRecoveryServicesVaultSettingsFile begin processing with ParameterSet 'ForSiteWithCertificate'.
DEBUG: 4:00:36 PM - using account id '[email protected]'...
DEBUG: RecoveryService - Going to upload the certificate
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '<GUID>'
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: '<GUID>'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PUT
Absolute Uri:
https://management.azure.com/Subscriptions/8b3ccdb2-9f12-4bc0-a7dc-295491ebc765/resourceGroups/HoroDrRG/providers/Microsoft.RecoveryServices/vaults/HoroDrVault/certificates/HoroDrVault8b3ccdb2-9f12-4bc0-a7dc-295491ebc765-1-16-2019-vaultcredentials?api-version=2016-06-01
Headers:
x-ms-client-request-id : f31828c6-4207-4882-831c-bad387e3f25f-2019-01-17 00:00:36Z-P
accept-language : en-US
Body:
{
"properties": {
"authType": "AAD",
"certificate": "<cert Thumbprint>"
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError
Headers:
Pragma : no-cache
X-Content-Type-Options : nosniff
x-ms-request-id : 79d1efff-120b-46e4-b3ec-2a7b179fe2f0
x-ms-client-request-id : 2f9c4851-85a9-48f1-8f63-e1e9a19fd74b,2f9c4851-85a9-48f1-8f63-e1e9a19fd74b
Strict-Transport-Security : max-age=31536000; includeSubDomains
x-ms-failure-cause : service
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id : 79d1efff-120b-46e4-b3ec-2a7b179fe2f0
x-ms-routing-request-id : CANADACENTRAL:20190117T000101Z:79d1efff-120b-46e4-b3ec-2a7b179fe2f0
Connection : close
Cache-Control : no-cache
Date : Thu, 17 Jan 2019 00:01:00 GMT
Server : Microsoft-IIS/10.0
Body:
{
"error": {
"code": "RestApiInternalError",
"message": "The REST API call encountered an internal error.\r\nWait for a few minutes and then try the operation again. If the issue persists, please contact Microsoft support.",
"target": null,
"details": null,
"innerError": null
}
}
Get-AzRecoveryServicesVaultSettingsFile : Unexpected character encountered while parsing value: T. Path '', line 0, position 0.
At line:1 char:1
+ Get-AzRecoveryServicesVaultSettingsFile -Vault $vault -SiteRecovery - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzRecoveryServicesVaultSettingsFile], JsonReaderException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile
DEBUG: AzureQoSEvent: CommandName - Get-AzRecoveryServicesVaultSettingsFile; IsSuccess - False; Duration - 00:00:24.9258879; Exception - Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path '', line 0, position 0.
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();
DEBUG: Finish sending metric.
DEBUG: 4:01:02 PM - GetAzureRmRecoveryServicesVaultSettingsFile end processing.
DEBUG: 4:01:02 PM - GetAzureRmRecoveryServicesVaultSettingsFile end processing.
@dragonfly91 Can you take a look at this issue?
Not sure if this is related but Get-AzRecoveryServicesVaultSettingsFile is throwing the following error when running the following command (aliases has been enabled). The cmdlet works fine on AzureRM 6.13.0
Get-AzureRmRecoveryServicesVaultSettingsFile -Vault $Vault -SiteRecovery | Select-Object -ExpandProperty FilePath
Get-AzRecoveryServicesVaultSettingsFile : Parameter set cannot be resolved using the specified named parameters.
- ... sfilename = Get-AzureRmRecoveryServicesVaultSettingsFile -Vault $Vaul ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesVaultSettingsFile], ParameterBindingException
- FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile
Same issue here. Is anyone working on this ?
I'm also experiencing this issue and it's blocking us upgrading to the AZ module. Is anyone working on this?
Absolutely the same problem... "Parameter set cannot be resolved using the specified named parameters."
Not sure if this is related but Get-AzRecoveryServicesVaultSettingsFile is throwing the following error when running the following command (aliases has been enabled). The cmdlet works fine on AzureRM 6.13.0
Get-AzureRmRecoveryServicesVaultSettingsFile -Vault $Vault -SiteRecovery | Select-Object -ExpandProperty FilePath
Get-AzRecoveryServicesVaultSettingsFile : Parameter set cannot be resolved using the specified named parameters.
... sfilename = Get-AzureRmRecoveryServicesVaultSettingsFile -Vault $Vaul ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesVaultSettingsFile], ParameterBindingException
- FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile
I am also got this issue, the workaround is uninstall Az and go back to 5.7.0 (i haven't try 6.1.3)
C:\WINDOWS\system32> Get-AzRecoveryServicesVaultSettings
Get-AzRecoveryServicesVaultSettings : The term 'Get-AzRecoveryServicesVaultSettings' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-AzRecoveryServicesVaultSettings
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzRecoveryServicesVaultSettings:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-AzureRmRecoveryServicesVaultSettingsFile
Get-AzRecoveryServicesVaultSettingsFile : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Get-AzureRmRecoveryServicesVaultSettingsFile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-AzRecoveryServicesVaultSettingsFile], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.RecoveryServices.GetAzureRmRecoveryServicesVaultSettingsFile
Unfortunately, due to underlying platform limitations, Az module requires a certificate whereas AzureRM does not. While we are pursuing this PS team, request you to kindly take a look at documentation where we provided an example and re-try (I understand the use case is in Site-recovery but this example is in Backup documentation)
https://docs.microsoft.com/azure/backup/backup-client-automation#registering-using-the-ps-az-module
Closing the issue since it is resolved and the documentation is updated.