Create cloudPcOnPremisesConnection using powershell
Hi
i have followed as per mentioned in the MS document, but when i try to create a Azure network connection always throws an error as mentioned in below. Can someone help on this.
Import-Module Microsoft.Graph.DeviceManagement.Administration
$params = @{
"@odata.type" = "#microsoft.graph.cloudPcOnPremisesConnection"
DisplayName = "test-canary-02"
Type = "hybridAzureADJoin"
SubscriptionId = "0ac520ee-14c0-480f-b6c9-0a90c585ffff"
SubscriptionName = "CPC customer 001 test subscription"
AdDomainName = "contoso001.com"
AdDomainUsername = "dcadmin"
OrganizationalUnit = "OU=Domain Controllers, DC=contoso001, DC=com"
ResourceGroupId = "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c585ad47/resourceGroups/CustomerRG"
VirtualNetworkId = "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c585ad47/resourceGroups/CustomerRG/providers/Microsoft.Network/virtualNetworks/canary01-MyVNET"
SubnetId = "/subscriptions/0ac520ee-14c0-480f-b6c9-0a90c585ad47/resourceGroups/CustomerRG/providers/Microsoft.Network/virtualNetworks/canary01-MyVNET/subnets/canary01-Subnet"
}
New-MgDeviceManagementVirtualEndpointOnPremisesConnection -BodyParameter $params
Error message:
PS C:\Windows\system32> New-MgDeviceManagementVirtualEndpointOnPremisesConnection -BodyParameter $params
New-MgDeviceManagementVirtualEndpointOnPremisesConnection : Cannot process request due to invalid input.
At line:1 char:1
- New-MgDeviceManagementVirtualEndpointOnPremisesConnection -BodyParame ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: ({ body = Micros...sesConnection }:<>f__AnonymousType74
1) [New-MgDeviceMan...nnection_Create], RestException
1 - FullyQualifiedErrorId : badRequest,Microsoft.Graph.PowerShell.Cmdlets.NewMgDeviceManagementVirtualEndpointOnPremisesConnection_Create
PS C:\Windows\system32>