Recursive references or co-dependent resources? #3885
-
I have a situation that I don't think is unique, and I'm curious if others have run into this scenario and if so what their solution is, or, just some input on my solution. The scenario is this: I am deploying a vnet and a set of VMs. These VMs will include a traditional Active Directory domain controller, and the other VMs will be joined to the domain. So, I need the DNS of the vnet to point towards the IP of the VM serving as the domain controller The issue here is that I don't want to statically assign IPs to VMs before creation, as I am creating many of these environments and they occupy varying IP spaces. Here comes the problem: How do you set the DNS of the vnet to the IP of a VM that depends on the vnet? My solution in code is below. Basically, I define the vnet, and then define the VM depending on the initial vnet creation. I then define the vnet a second time, with the DNS property set to the IP address output from the VM creation, and that second vnet definition is set to depend on the VM This works, but seems less than perfect. Maybe it's the only way, but curious if anyone has a better way? Or at least this could serve as feedback to the team that there are these recursive reference cases out there
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
This is the solution that I have found to be 100% reliable for deploying 2 domain controllers in a new vnet. I know you mentioned only 1 DC, so yours should be easier, however it may give you some ideas. This is all just using Vnet DNS, nothing on any NICS. Set vnet dns to "[variables('DC1PrivateIPAddress')]", Set vnet dns to "[variables('DC1PrivateIPAddress')]", Set vnet dns to "[variables('DC1PrivateIPAddress')]", If you are using DSC to build the domain controllers, you likely also want to clear out and static IP that might get set inside the OS. The task below in DSC (at the very end) then also clears local DNS addresses that get set on the servers and reboots, via a scheduled task. Sample DSC configs Secondaries: https://github.com/brwilkinson/AzureDeploymentFramework/blob/main/ADF/ext-DSC/DSC-ADSecondary.ps1 |
Beta Was this translation helpful? Give feedback.
This is the solution that I have found to be 100% reliable for deploying 2 domain controllers in a new vnet.
I know you mentioned only 1 DC, so yours should be easier, however it may give you some ideas.
This is all just using Vnet DNS, nothing on any NICS.
https://github.com/brwilkinson/AzureDeploymentFramework/blob/60f2a6721034bacc441ad42a6c4701afaffe99f4/ADF/bicep/01-dp-rg-ALLRG.bicep#L486
Set vnet dns to
"[variables('DC1PrivateIPAddress')]",
"[variables('AzureDNS')]"
Deploy DC1
Set vnet dns to
"[variables('DC1PrivateIPAddress')]",
Deploy DC2
Set vnet dns to
"[variables('DC1PrivateIPAddress')]",
"[variables('DC2P…