Azure / Azure/azure-powershell

New-AzSentinelDataConnector Unexpected Error Creating Connector

Open
#20,869 7 comments 0 reactions 1 assignee Assigned to @chlahav View on GitHub
act-codegen-extensibility-squad bug customer-reported needs-team-attention SecurityInsights Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

![image](https://user-images.githubusercontent.com/108864639/217292931-b8d686f3-9b16-42c9-bdf9-4d5fecefcbda.png)

Calling the New-AzSentinelDataConnector module I receive the error inside of the picture;

Failed to parse input. Error='Required property 'dataTypes' not found in JSON. Path 'properties', line 1, position 45.'

Is this expected? If not, how do I connect/create a connection via CLI to AzureActiveDirectory (and all of the other available connectors via the New-AzSentinelDataConnector module)?

### Issue script & Debug output

```PowerShell

Command: New-AzSentinelDataConnector -ResourceGroupName "{rg}" -WorkspaceName "{workspace}" -Kind 'AzureActiveDirectory'

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/{subid}/resourceGroups/{rg}/providers/Microsoft.OperationalInsights/workspaces/{workspace}/providers/Microsoft.SecurityInsights/dataConnectors/{connectorid}?api-version=2021-09-01-preview

Headers:
x-ms-unique-id : 2
x-ms-client-request-id : {}
CommandName : Az.SecurityInsights.internal\New-AzSentinelDataConnector
FullCommandName : New-AzSentinelDataConnector_Create
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v7.3.2,Az.SecurityInsights/3.0.1

Body:
{
"kind": "AzureActiveDirectory",
"properties": {
"tenantId": "{tid}"
}
}

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

Status Code:
BadRequest

Headers:
Cache-Control : no-cache
Pragma : no-cache
Server : Kestrel
x-ms-ratelimit-remaining-subscription-resource-requests: 499
x-ms-request-id : {}
x-ms-correlation-request-id : {}
x-ms-routing-request-id : UKSOUTH:{}:{}
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Tue, 07 Feb 2023 15:50:44 GMT

Body:
{
"error": {
"code": "BadRequest",
"message": "Failed to parse input. Error='Required property 'dataTypes' not found in JSON. Path 'properties', line 1, position 45.'"
}
}

DEBUG: ResponseCreated:
DEBUG: BeforeResponseDispatch:
New-AzSentinelDataConnector_Create: {directory}\PowerShell\Modules\Az.SecurityInsights\3.0.1\custom\New-AzSentinelDataConnector.ps1:701:13
Line |
701 | Az.SecurityInsights.internal\New-AzSentinelDataConnector …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Failed to parse input. Error='Required property 'dataTypes' not found in JSON. Path 'properties', line 1, position 45.'
DEBUG: [Finally]: Getting exception 'Microsoft.Azure.Commands.Common.Exceptions.AzPSCloudException: InternalException' from response
DEBUG: Finally:
DEBUG: CmdletAfterAPICall:
DEBUG: [CmdletProcessRecordAsyncEnd]: Finish HTTP process
DEBUG: CmdletProcessRecordAsyncEnd:
DEBUG: CmdletProcessRecordEnd:
DEBUG: AzureQoSEvent: Module: Az.SecurityInsights:3.0.1; CommandName: New-AzSentinelDataConnector; PSVersion: 7.3.2; IsSuccess: False; Duration: 00:00:00.4019486; Exception: InternalException;
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.3.2
PSEdition Core
GitCommitId 7.3.2
OS Microsoft Windows 10.0.19045
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 ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.11.2 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 3.0.1 Az.SecurityInsights {Get-AzSentinelAlertRule, Get-AzSentinelAlertRuleAction, Get-AzSentinelAlertRuleTemplate, Get-AzSentinelAutomationRule…}
```

### Error output

```PowerShell
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 15:54:04 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 15:54:04 - using account id '{my email}'...
DEBUG: 15:54:04 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
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: 8

Message : [BadRequest] : Failed to parse input. Error='Required property 'dataTypes' not found in JSON. Path 'properties', line 1, position 45.'
StackTrace :
Exception : System.Exception
InvocationInfo : {New-AzSentinelDataConnector_Create}
Line : Az.SecurityInsights.internal\New-AzSentinelDataConnector @PSBoundParameters

Position : At {dir}\PowerShell\Modules\Az.SecurityInsights\3.0.1\custom\New-AzSentinelDataConnector.ps1:701 char:13
+ Az.SecurityInsights.internal\New-AzSentinelDataConnector …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 8

HistoryId: 2

Message : [BadRequest] : Failed to parse input. Error='Required property 'dataTypes' not found in JSON. Path 'properties', line 1, position 45.'
StackTrace :
Exception : System.Exception
InvocationInfo : {New-AzSentinelDataConnector_Create}
Line : Az.SecurityInsights.internal\New-AzSentinelDataConnector @PSBoundParameters

Position : At {directory}\PowerShell\Modules\Az.SecurityInsights\3.0.1\custom\New-AzSentinelDataConnector.ps1:701 char:13
+ Az.SecurityInsights.internal\New-AzSentinelDataConnector …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 2

DEBUG: AzureQoSEvent: Module: Az.Accounts:2.11.2; CommandName: Resolve-AzError; PSVersion: 7.3.2; IsSuccess: True; Duration: 00:00:00.1886978
DEBUG: 15:54:04 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 15:54:04 - ResolveError end processing.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.