Azure / Azure/azure-powershell
Get-AzSecurityContact gives Unable to deserialize the response error
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
In the az.security 1.5.0 in combination with ps 7 the command Get-AzSecurityContact gives a unable to deserialize the response error
### Issue script & Debug output
```PowerShell
PS C:\Users> Get-AzSecurityContact
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 2:17:59 PM - GetSecurityContacts begin processing with ParameterSet 'SubscriptionScope'.
DEBUG: 2:17:59 PM - using account id 'xxx'...
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'xxxl', environment: 'AzureCloud', tenant: 'xxx'
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 2:17:59 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'xxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'xxx'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 19044434-9785-45b4-9390-0f9867334dcf
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:
=== Token Acquisition finished successfully:
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'xxx', UserId: 'xxx'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/xxx/providers/Microsoft.Security/securityContacts?api-version=2020-01-01-preview
Headers:
x-ms-client-request-id : 701adfdf-cd23-4d6e-9cd9-9173b5c78cf3
Accept-Language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-ratelimit-remaining-subscription-resource-requests: 749
api-supported-versions : 2020-01-01-preview
Server : Kestrel
x-ms-request-id : a83c99d3-306b-4e05-b74c-cba7fbf21267
x-ms-correlation-request-id : a83c99d3-306b-4e05-b74c-cba7fbf21267
x-ms-routing-request-id : WESTEUROPE:20231120T131759Z:a83c99d3-306b-4e05-b74c-cba7fbf21267
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Mon, 20 Nov 2023 13:17:59 GMT
Body:
[{"properties":{"alertNotifications":{"state":"On","minimalSeverity":"High"},"notificationsByRole":{"state":"On","roles":["Owner"]},"emails":"xxx","phone":""},"id":"/subscriptions/xxxproviders/Microsoft.Security/securityContacts/default","name":"default","type":"Microsoft.Security/securityContacts","etag":"\xxx\"","location":"West Europe"}]
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Get-AzSecurityContact: Unable to deserialize the response.
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 2:17:59 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: az.security:1.5.0; CommandName: Get-AzSecurityContact; PSVersion: 7.2.8; IsSuccess: False; Duration: 00:00:01.2235137; Exception: Unable to deserialize the response.;
DEBUG: 2:18:00 PM - GetSecurityContacts end processing.
```
### Environment data
```PowerShell
PS C:\Users> $psversiontable
Name Value
---- -----
PSVersion 7.2.8
PSEdition Core
GitCommitId 7.2.8
OS Microsoft Windows 10.0.14393
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name
---------- ------- ---------- ----
Script 2.13.2 Az.Accounts
Script 1.5.0 az.security
```
### Error output
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.