When I run this cmdlet using a powershell script,
New-AzResource -ResourceId "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/will-vnet-rg/providers/Microsoft.AAD/DomainServices/xxxxx.xxxxxxxx.com" -Location eastus2 -Properties @{"DomainName"="xxxxx.xxxxxxxx.com"; "SubnetId"="/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/will-vnet-rg/providers/Microsoft.Network/virtualNetworks/will-vnet/subnets/will-core-subnet"} -ApiVersion 2017-06-01 -Force -Verbose
I get this error,
New-AzResource : The operation failed because resource is in the: 'Failed' state. Please check the logs for more details.
At C:\tf\advantage\dev\deploy\scripts\Azure-Functions.ps1:89 char:5
+ New-AzResource -ResourceId "/subscriptions/$subscription/resource ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzResource], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
The resources it depends on exist, earlier in my script I create them. I am able to create the Domain Service manually through the Azure Portal, however, using the PowerShell cmdlet to create it does not work.
In the portal, the resource says "The managed domain is in a failed state. Contact support with your Azure AD tenant ID and the domain name of the managed domain."
][1]