Please refer if this can give an idea
Unlike other Azure resources, Azure AD Domain Services is a resource that is directly associated to the Azure AD tenant your Azure subscription is linked to. You need global administrator privileges in your Azure AD tenant to enable Azure AD DS.
By default, your account should have Contributor access to the subscription as that is the RBAC role specified during the deployment. The Owner role is not permitted with the initial deployment. To get owner permissions on your repro tenant:
Add your @microsoft alias to your repro tenant as a guest, assign GA
role.
Add your @microsoft alias as a member of the AAD group that is
inheriting the RBAC permissions.
Make sure that your MS alias account is listed as a Co-Administrator (or another legacy administrator type) on the subscription in the projected tenant . If you do not see the assignment and are unable to make any change, add your MS alias as co-admin of the subscription in the MS tenant.
Add co-admin?
Switch to you repro tenant using your MS account and elevate permissions, (AAD -> Properties -> Access management for Azure resources).
AAD Domain Services Deployment
Pre-requisite steps to deploy AADDS in your test tenant against your projected Azure subscription.
If you project subscription resides in the Microsoft tenant, at some point the security policy in place will add network denies rules that will block the necessary port, causing the deployment to fail, to avoid that situation, create your network, subnets, bastion instance and NSG manually and add the rule to the NSG:
First, Register the Azure AD Domain Services resource provider using the Register-AzResourceProvider cmdlet:
Register-AzResourceProvider -ProviderNamespace Microsoft.AAD
Next, Create a resource group using the New-AzResourceGroup cmdlet.
$ResourceGroupName = "myResourceGroup"
$AzureLocation = "westus"
# Create the resource group.
New-AzResourceGroup `
-Name $ResourceGroupName `
-Location $AzureLocation
Create the virtual network and subnets for Azure AD Domain Services.
$VnetName = "myVnet"
# Create the dedicated subnet for Azure AD Domain Services.
$SubnetName = "DomainServices"
$AaddsSubnet = New-AzVirtualNetworkSubnetConfig `
-Name $SubnetName `
-AddressPrefix 10.0.0.0/24
# Create an additional subnet for your own VM workloads
$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 westus `
-Name $VnetName `
-AddressPrefix 10.0.0.0/16 `
-Subnet $AaddsSubnet,$WorkloadSubnet
Create a network security group
The following PowerShell cmdlets use New-AzNetworkSecurityRuleConfig to create the rules, then New-AzNetworkSecurityGroup to create the network security group. The network security group and rules are then associated with the virtual network subnet using the Set-AzVirtualNetworkSubnetConfig cmdlet.
$NSGName = "aaddsNSG"
# Create a rule to allow inbound TCP port 3389 traffic from Microsoft secure access workstations for troubleshooting
$nsg201 = New-AzNetworkSecurityRuleConfig -Name AllowRD `
-Access Allow `
-Protocol Tcp `
-Direction Inbound `
-Priority 201 `
-SourceAddressPrefix CorpNetSaw `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 3389
# Create a rule to allow TCP port 5986 traffic for PowerShell remote management
$nsg301 = New-AzNetworkSecurityRuleConfig -Name AllowPSRemoting `
-Access Allow `
-Protocol Tcp `
-Direction Inbound `
-Priority 301 `
-SourceAddressPrefix AzureActiveDirectoryDomainServices `
-SourcePortRange * `
-DestinationAddressPrefix * `
-DestinationPortRange 5986
# Create the network security group and rules
$nsg = New-AzNetworkSecurityGroup -Name $NSGName `
-ResourceGroupName $ResourceGroupName `
-Location $AzureLocation `
-SecurityRules $nsg201,$nsg301
# Get the existing virtual network resource objects and information
$vnet = Get-AzVirtualNetwork -Name $VnetName -ResourceGroupName $ResourceGroupName
$subnet = Get-AzVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name $SubnetName
$addressPrefix = $subnet.AddressPrefix
# Associate the network security group with the virtual network subnet
Set-AzVirtualNetworkSubnetConfig -Name $SubnetName `
-VirtualNetwork $vnet `
-AddressPrefix $addressPrefix `
-NetworkSecurityGroup $nsg
$vnet | Set-AzVirtualNetwork
OR For example, you can use the following script to create a rule allowing RDP: (Reference)
Get-AzNetworkSecurityGroup
-Name "nsg-name"
-ResourceGroupName "resource-group-name"
| Add-AzNetworkSecurityRuleConfig
-Name "new-rule-name"
-Access "Allow"
-Protocol "TCP" -Direction "Inbound"
-Priority "priority-number"
-SourceAddressPrefix "CorpNetSaw" // $serviceTagName
-SourcePortRange "*"
-DestinationPortRange "3389"
-DestinationAddressPrefix "*"
| Set-AzNetworkSecurityGroup
And then create a managed domain following the Reference > Enable Azure DS Domain Services using PowerShell | Microsoft Docs
Browse Azure AD -> Enterprise Applications ->All Applications -> Search for each of the following application IDs.
If any of the Enterprise Applications like AzureActiveDirectoryDomainControllerServices or DomainControllerServices weren’t found under all applications under Enterprise applications you will need to manually create them via the following PowerShell example (replace the appID variable with the appID you were missing your repro tenant.
Once the three service principals are created, add them to the group previously created. You can add them via searching for their app ID in Add Member dialog
Connect-AzureAD
$appID = "d87dcbc6-a371-462e-88e3-28ad15ec4e64"
$displayname = "Domain Controller Services"
New-AzureADServicePrincipal -AccountEnabled $true -AppId $appID -AppRoleAssignmentRequired $false -DisplayName $displayname -ServicePrincipalType Application
Once the three service principals are created, add them to the group previously created(Domain controller services). You can add them via searching for their app ID in Add Member dialog
You can now enable AAD DS in the portal UI. while logged into to your repro tenant via your repro tenant's Global Admin account.
Provisioning can take some time. You may also get some errors while provisioning, but as long as the process continues, continue to watch the deployment, as the deployment may succeed after sometime.
Also see Troubleshoot domain-join with Azure AD Domain Services | Microsoft Docs
And Tutorial - Create an Azure Active Directory Domain Services managed domain | Microsoft Docs