Getting error while provisioning managed domain using PowerShell

%3CLINGO-SUB%20id%3D%22lingo-sub-1516011%22%20slang%3D%22en-US%22%3EGetting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1516011%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20provision%20Azure%20ADDS%20managed%20domain%20to%20prepare%20POC%20for%20my%20client.%20I%20used%20the%20same%20set%20of%20command%20earlier%20multiple%20times%20and%20didn't%20get%20any%20error.%20But%20today%20when%20I%20tried%20doing%20the%20same%20using%20PowerShell%2C%20I%20got%20below%20error%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-AzResource%20%3A%20BadRequest%20%3A%20The%20property%20'ReplicaSets'%20is%20missing.%3CBR%20%2F%3ECorrelationId%3A%207588b953-9e72-4c23-8d20-a0a632928778%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20New-AzResource%20-ResourceId%20%22%2Fsubscriptions%2F%24AzureSubscriptionId%2Fresou%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20CloseError%3A%20(%3A)%20%5BNew-AzResource%5D%2C%20ErrorResponseMessageException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20following%20Microsoft%20Document%20and%20my%20command%20is%20as%20below%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24AzureSubscriptionId%20%3D%20%22MY_AZURE_SUBSCRIPTION_ID%22%3CBR%20%2F%3E%24ManagedDomainName%20%3D%20%22My%20Domain%22%3C%2FP%3E%3CP%3E%23%20Enable%20Azure%20AD%20Domain%20Services%20for%20the%20directory.%3CBR%20%2F%3ENew-AzResource%20-ResourceId%20%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.AAD%2FDomainServices%2F%24ManagedDomainName%22%20%60%3CBR%20%2F%3E-Location%20%24AzureLocation%20%60%3CBR%20%2F%3E-Properties%20%40%7B%22DomainName%22%3D%24ManagedDomainName%3B%20%60%3CBR%20%2F%3E%22SubnetId%22%3D%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.Network%2FvirtualNetworks%2F%24VnetName%2Fsubnets%2FDomainServices%22%7D%20%60%3CBR%20%2F%3E-Force%20-Verbose%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20get%20same%20error%20when%20I%20try%20from%20Azure%20PowerShell%20prompt%20as%20well.%3C%2FP%3E%3CP%3EAny%20help%20in%20this%20regard%20is%20helpful.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1516011%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20AD%20Domain%20Services%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1521864%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1521864%22%20slang%3D%22en-US%22%3EHello%20there%2C%3CBR%20%2F%3Edid%20you%20try%20to%20provision%20the%20ADDS%20domain%20services%20from%20the%20portal%3F%3CBR%20%2F%3E%3CBR%20%2F%3ERegards%2C%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1521875%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1521875%22%20slang%3D%22en-US%22%3EAllow%20me%20to%20add%2C%20can%20you%20share%20the%20full%20set%20of%20commands%20that%20you%20have%20ran%2C%20before%20the%20ones%20that%20you%20have%20shared%3F%20did%20you%20confirm%20the%20dedicated%20subnet%20creation%20to%20host%20the%20ADDS%20domain%20services%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThank%20you%2C%3CBR%20%2F%3ECharbel%20HANNA%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1528985%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1528985%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F573584%22%20target%3D%22_blank%22%3E%40Charbelhanna%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20reply.%20I%20can%20provision%20from%20console%20but%20cannot%20do%20so%20using%20PowerShell%20from%20my%20system%20and%20PowerShell%20prompt%20of%20console.%20I%20have%20created%20dedicated%20subnets%20as%20well.%20Here%20is%20full%20script%20that%20I%20am%20trying.%3C%2FP%3E%3CP%3EConnect%20to%20Azure%20AD%3C%2FP%3E%3CP%3ECreate%20Group%2C%20user%20and%20add%20user%20to%20group%3C%2FP%3E%3CP%3ERegister-AzResourceProvider%20-ProviderNamespace%20Microsoft.AAD%3C%2FP%3E%3CP%3E%24ResourceGroupName%20%3D%20%22abhayadadds%22%3CBR%20%2F%3E%24AzureLocation%20%3D%20%22eastus%22%3C%2FP%3E%3CP%3E%23%20Create%20the%20resource%20group.%3CBR%20%2F%3ENew-AzResourceGroup%20%60%3CBR%20%2F%3E-Name%20%24ResourceGroupName%20%60%3CBR%20%2F%3E-Location%20%24AzureLocation%3C%2FP%3E%3CP%3E%24VnetName%20%3D%20%22abhayVnet%22%3C%2FP%3E%3CP%3E%23%20Create%20the%20dedicated%20subnet%20for%20AAD%20Domain%20Services.%3CBR%20%2F%3E%24AaddsSubnet%20%3D%20New-AzVirtualNetworkSubnetConfig%20%60%3CBR%20%2F%3E-Name%20DomainServices%20%60%3CBR%20%2F%3E-AddressPrefix%2010.0.0.0%2F24%3C%2FP%3E%3CP%3E%24WorkloadSubnet%20%3D%20New-AzVirtualNetworkSubnetConfig%20%60%3CBR%20%2F%3E-Name%20Workloads%20%60%3CBR%20%2F%3E-AddressPrefix%2010.0.1.0%2F24%3C%2FP%3E%3CP%3E%23%20Create%20the%20virtual%20network%20in%20which%20you%20will%20enable%20Azure%20AD%20Domain%20Services.%3CBR%20%2F%3E%24Vnet%3D%20New-AzVirtualNetwork%20%60%3CBR%20%2F%3E-ResourceGroupName%20%24ResourceGroupName%20%60%3CBR%20%2F%3E-Location%20%24AzureLocation%20%60%3CBR%20%2F%3E-Name%20%24VnetName%20%60%3CBR%20%2F%3E-AddressPrefix%2010.0.0.0%2F16%20%60%3CBR%20%2F%3E-Subnet%20%24AaddsSubnet%2C%24WorkloadSubnet%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24AzureSubscriptionId%20%3D%20%22My%20Subscription%20ID%22%3CBR%20%2F%3E%24ManagedDomainName%20%3D%20%22Managed%20domain%20name%22%3C%2FP%3E%3CP%3E%23%20Enable%20Azure%20AD%20Domain%20Services%20for%20the%20directory.%3CBR%20%2F%3ENew-AzResource%20-ResourceId%20%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.AAD%2FDomainServices%2F%24ManagedDomainName%22%20%60%3CBR%20%2F%3E-Location%20%24AzureLocation%20%60%3CBR%20%2F%3E-Properties%20%40%7B%22DomainName%22%3D%24ManagedDomainName%3B%20%60%3CBR%20%2F%3E%22SubnetId%22%3D%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.Network%2FvirtualNetworks%2F%24VnetName%2Fsubnets%2FDomainServices%22%7D%20%60%3CBR%20%2F%3E-Force%20-Verbose%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1607976%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1607976%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F108215%22%20target%3D%22_blank%22%3E%40Abhay%20Pujari%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%20I%20have%20the%20same%20problem.%20My%20deployment%20script%20was%20running%20perfectly%20one%20month%20ago%20and%20now%20runs%20into%20this%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-AzResource%20%3A%20BadRequest%20%3A%20The%20property%20'ReplicaSets'%20is%20missing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20seems%20like%20a%20bug%20that%20made%20the%20property%20ReplicaSets%20mandatory.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1670145%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1670145%22%20slang%3D%22en-US%22%3E%3CP%3ESame%20here!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1731510%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1731510%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F108215%22%20target%3D%22_blank%22%3E%40Abhay%20Pujari%3C%2FA%3ESame%20issue%20here%2C%20on%20any%20tenant.%20I%20posted%20the%20bug%20report%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F63558%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F63558%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20going%20to%20try%20going%20with%20a%20JSON%20template%20and%20see%20if%20that%20fixes%20it.%20Documentation%20says%20ReplicaSets%20is%20non%20mandatory%20and%20it%20was%20added%20in%202020%20as%20optional%20but%20its%20kicking%20back%20as%20missing%20from%20the%20list%20of%20properties.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1732286%22%20slang%3D%22en-US%22%3ERe%3A%20Getting%20error%20while%20provisioning%20managed%20domain%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1732286%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F108215%22%20target%3D%22_blank%22%3E%40Abhay%20Pujari%3C%2FA%3EThe%20fix%20is%20to%20specify%20the%20ApiVersion%20when%20you%20kick%20off%20New-AzResource...%20the%20code%20would%20be%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENew-AzResource%20-ResourceId%20%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.AAD%2FDomainServices%2F%24ManagedDomainName%22%20%60%3CBR%20%2F%3E-Location%20%24AzureLocation%20%60%3CBR%20%2F%3E-Properties%20%40%7B%22DomainName%22%3D%24ManagedDomainName%3B%20%60%3CBR%20%2F%3E%22SubnetId%22%3D%22%2Fsubscriptions%2F%24AzureSubscriptionId%2FresourceGroups%2F%24ResourceGroupName%2Fproviders%2FMicrosoft.Network%2FvirtualNetworks%2F%24VnetName%2Fsubnets%2FDomainServices%22%7D%20%60%20-ApiVersion%20%222017-06-01%22%20-Force%20-Verbose%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi All,

 

I am trying to provision Azure ADDS managed domain to prepare POC for my client. I used the same set of command earlier multiple times and didn't get any error. But today when I tried doing the same using PowerShell, I got below error

 

New-AzResource : BadRequest : The property 'ReplicaSets' is missing.
CorrelationId: 7588b953-9e72-4c23-8d20-a0a632928778
At line:1 char:1
+ New-AzResource -ResourceId "/subscriptions/$AzureSubscriptionId/resou ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzResource], ErrorResponseMessageException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet

 

I am following Microsoft Document and my command is as below

 

$AzureSubscriptionId = "MY_AZURE_SUBSCRIPTION_ID"
$ManagedDomainName = "My Domain"

# Enable Azure AD Domain Services for the directory.
New-AzResource -ResourceId "/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AAD/DomainServices/$ManagedDomainName" `
-Location $AzureLocation `
-Properties @{"DomainName"=$ManagedDomainName; `
"SubnetId"="/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Network/virtualNetworks/$VnetName/subnets/DomainServices"} `
-Force -Verbose

 

I get same error when I try from Azure PowerShell prompt as well.

Any help in this regard is helpful.

7 Replies
Hello there,
did you try to provision the ADDS domain services from the portal?

Regards,
Allow me to add, can you share the full set of commands that you have ran, before the ones that you have shared? did you confirm the dedicated subnet creation to host the ADDS domain services?

Thank you,
Charbel HANNA

@Charbelhanna 

Thank you for your reply. I can provision from console but cannot do so using PowerShell from my system and PowerShell prompt of console. I have created dedicated subnets as well. Here is full script that I am trying.

Connect to Azure AD

Create Group, user and add user to group

Register-AzResourceProvider -ProviderNamespace Microsoft.AAD

$ResourceGroupName = "abhayadadds"
$AzureLocation = "eastus"

# Create the resource group.
New-AzResourceGroup `
-Name $ResourceGroupName `
-Location $AzureLocation

$VnetName = "abhayVnet"

# Create the dedicated subnet for AAD Domain Services.
$AaddsSubnet = New-AzVirtualNetworkSubnetConfig `
-Name DomainServices `
-AddressPrefix 10.0.0.0/24

$WorkloadSubnet = New-AzVirtualNetworkSubnetConfig `
-Name Workloads `
-AddressPrefix 10.0.1.0/24

# Create the virtual network in which you will enable Azure AD Domain Services.
$Vnet= New-AzVirtualNetwork `
-ResourceGroupName $ResourceGroupName `
-Location $AzureLocation `
-Name $VnetName `
-AddressPrefix 10.0.0.0/16 `
-Subnet $AaddsSubnet,$WorkloadSubnet


$AzureSubscriptionId = "My Subscription ID"
$ManagedDomainName = "Managed domain name"

# Enable Azure AD Domain Services for the directory.
New-AzResource -ResourceId "/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AAD/DomainServices/$ManagedDomainName" `
-Location $AzureLocation `
-Properties @{"DomainName"=$ManagedDomainName; `
"SubnetId"="/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Network/virtualNetworks/$VnetName/subnets/DomainServices"} `
-Force -Verbose

@Abhay Pujari 

Hi, I have the same problem. My deployment script was running perfectly one month ago and now runs into this error.

 

New-AzResource : BadRequest : The property 'ReplicaSets' is missing.

 

It seems like a bug that made the property ReplicaSets mandatory.

@Abhay PujariSame issue here, on any tenant. I posted the bug report: https://github.com/MicrosoftDocs/azure-docs/issues/63558

 

I am going to try going with a JSON template and see if that fixes it. Documentation says ReplicaSets is non mandatory and it was added in 2020 as optional but its kicking back as missing from the list of properties.

@Abhay PujariThe fix is to specify the ApiVersion when you kick off New-AzResource... the code would be:

 

New-AzResource -ResourceId "/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.AAD/DomainServices/$ManagedDomainName" `
-Location $AzureLocation `
-Properties @{"DomainName"=$ManagedDomainName; `
"SubnetId"="/subscriptions/$AzureSubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.Network/virtualNetworks/$VnetName/subnets/DomainServices"} ` -ApiVersion "2017-06-01" -Force -Verbose