Error listing AppService certificates using fluent api
See original GitHub issueFrom @NicolaiPetri on July 11, 2017 7:46
When fetching the list of certificates for specific subscription I’ll get the following exception: “Unable to deserialize the response.” Microsoft.Rest.SerializationException
The code that fails is
var certificates = azure.AppServices.AppServiceCertificates.List();
The full exception is here :
Exception: Microsoft.Rest.SerializationException: Unable to deserialize the response. ---> Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Microsoft.Azure.Management.AppService.Fluent.Models.Page'1[Microsoft.Azure.Management.AppService.Fluent.Models.CertificateInner]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path '', line 1, position 1.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureArrayContract(JsonReader reader, Type objectType, JsonContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject[T](String json, JsonSerializerSettings settings)
at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.AppService.Fluent.CertificatesOperationsExtensions.<ListAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.AppService.Fluent.AppServiceCertificatesImpl.<ListInnerAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.ResourceManager.Fluent.Core.TopLevelModifiableResources`5.List()
at Microsoft.Azure.Management.AppService.Fluent.AppServiceCertificatesImpl.Microsoft.Azure.Management.ResourceManager.Fluent.Core.CollectionActions.ISupportsListing<Microsoft.Azure.Management.AppService.Fluent.IAppServiceCertificate>.List()
at AzureExporter2.ResourceIdCachedService.GetResourceId(IAzure azure, String resourceId, String resourceType, String resourceName) in C:\Projects\Dashboard\azure_exporter\AzureExporter2\ResourceIdCachedService.cs:line 47
at AzureExporter2.Program.<>c__DisplayClass1_0.<Main>b__1(IAsyncResult ar) in C:\Projects\Dashboard\azure_exporter\AzureExporter2\Program.cs:line 88
I can on request provide the failing and valid json response in a private message.
Copied from original issue: Azure/azure-sdk-for-net#3474
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (5 by maintainers)
Top Results From Across the Web
Error listing AppService certificates using fluent api #3474
When fetching the list of certificates for specific subscription I'll get the following exception: "Unable to deserialize the response.
Read more >Microsoft.Azure.Management.AppService.Fluent.Models ...
Object with a list of the resources that need to be moved and the resource group they should be moved to. CsmOperationDescription. Description...
Read more >Problems installing a TLS certificate on an Azure App ...
The trouble is that documentation and code samples for the SDK are woefully sparse. How can I upload and install a third-party TLS...
Read more >FAQ SSL certificates for Web Apps and App Service ...
Here is a list of commonly asked questions for App Service Certificates. How do I purchase and configure a new SSL certificate in...
Read more >application gateway · Community - Azure Feedback
Currently during my app service certificate renewal, my application gateway does not automatically update the new certificate. This caused my application ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi. Any update on this?
Here’s a workaround:
and then use
Azure.Configure().WithDelegatingHandler(new FixCertificatesHandler())