-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WaitforADDomain: Get-Domain in WaitforADDomain #124
Comments
@oradcliffe As per #73 - can you ensure you're using the whatever the local 'Administrator' password was (before the domain promotion) for the |
@oradcliffe |
@iainbrighton Oh thanks for that; I kind of thought that was the case but didn't see that. I have the following in my template:
GTM-DC01 is the same parameter that I use for the local admin credentials on this particular machine, so they should be the same. Here's where they are referenced in my DSC script:
And $DomainCreds is being created after importing resources in my DSC script like this:
|
@iainbrighton Rather than using the |
@iainbrighton - I dug around a bit to see what |
@oradcliffe I'm not sure that you need the There may well be an issue using the |
Oh, OK, that makes life easier then. I was just following some of the active directory quickstart templates and noticed that they were using |
Do you happen to know if there's a problem passing credentials into DSC if the password is stored in a key vault and referenced in the parameters JSON file? Or does that require some access to the key vault other than just whoever is running the template's @outlook or whatever account? |
I am seeing similar issues when trying to create a second DC using I have one DC that comes up, domain is there, hooray. I have a server that successfully joins the domain using a JSON domain join extension, so I know the domain is up and available. The second DC I am trying to create with another DSC extension - I have it depending on that first server joining the domain, so at that point I am sure the domain is available, yet I get an error saying that the domain can't be found. I am using the same credentials throughout, with the password being stored in a keyvault in Azure so as not to have it in plain text on github. So the first DC machine is created - local admin1, pass1. After the domain is created, it uses these same credentials, correct? domain\admin1, pass1. Now, if I use those same credentials to make the second DC, those should theoretically work right? Unless it is trying to create another domain user with those same credentials, in which case I would expect that to fail. Regardless, whether or not I specify new credentials or reuse the same ones from the first DC (by literally calling the same parameter for both), it fails saying it can't find the domain. It seems like there's a good few threads open with some similar issue; should we try to consolidate them? |
@oradcliffe Are you running on Server 2016? Have you tried the newest version of xActiveDirectory (2.16.0.0)? There were some issues fixed with waiting for domain controller promotion to complete specifically with the Azure DSC extension. |
@kwirkykat Hey, I haven't had a chance to try yet - I'll branch and try it ASAP. I just got a lot of new equipment at home so I've been setting up a little homelab so I haven't had a ton of free time. |
@kwirkykat do you think that could solve the issue of not being able to pass in real credentials using the protected settings? Right now I have it working, but I had to do it like this:
Ugh that formatting is atrocious, sorry about that. |
@oradcliffe From the schema you provided in a previous comment, I think you may have combined the old extension schema with the newer schema. Specifically I see both public settings --> configurationArguments (new schema) along with protected settings --> Items (old schema). You can see the old schema vs. the new schema in this blog: https://blogs.msdn.microsoft.com/powershell/2016/02/26/arm-dsc-extension-settings/ |
@kwirkykat This was very much a work in progress for a long time while I learned how all of this worked - I see what you're saying though, and thank you for that link. I'm going to update the DSC extension settings tonight; maybe that was my issue all along. Thank you for pointing that out - I actually used as many samples as I could find to learn this stuff and there were quite a few like that back around December so I thought that was correct. |
@kwirkykat within the new schema, do we still reference the private settings with privatesettingsref? So it would look like: "properties": { |
@kwirkykat Also, just as an FYI, I do have this working in 2012R2 with whatever version of xAD I have - the issue I think I was having was with credentials on the domain join, which is why in my master branch I kind of just have them hardcoded in there. If you care to take a look, it's all here in the master branch: https://github.com/oradcliffe/AzureRm-Windows-Domain |
@kwirkykat so I just reran with the new settings in the DSC extension and it did in fact fail with "A parameter cannot be found that matches parameter name 'parameterOfTypePSCredential1'.\n\nAnother common error is to specify parameters of type PSCredential without an explicit type. Please be sure to use a typed parameter in DSC Configuration, for example:\n\n configuration Example {\n param([PSCredential] $UserAccount)" |
OK, I have updated the secure arguments to look like: "configurationdata": { That seeeems to make more sense to me; I'm running it now. |
@oradcliffe There is no more PrivateSetttingsRef because the whole credential object now goes into the protected settings. So using the new schema your config arguments should look like this:
|
@kwirkykat OK, so what I just posted is the correct way to do it, right? That would be awesome if this worked; it was the only part of my template that I really hated because the credentials would never be encrypted that way. |
@kwirkykat Ah, well this time it failed with: Which sort of makes sense because I branched from master, which is working, and just made changes to the protected settings like we were talking about. I bet it can't find the DC because the credentials it's getting aren't valid, which is the problem I was having before when I had to put the password in the non-protected settings. |
@kwirkykat would the way I'm defining my parameters be an issue? "GTM-DC01AdminUserName": { If I'm including adminusername in the protected settings, does that need to have type securestring? |
@oradcliffe I don't think the admin user name needs to be a secure string but maybe try it with the password as a 'string' rather than 'securestring'? I know it's not as secure but it could be that the extension is re-encrypting the secure string and then only decrypting it once rather than twice. The example in the blog seems to have just a string: |
@kwirkykat Ok, I'll give that a shot and report back. I just started a deployment with kind of the opposite, with both set to secure string in the parameters section so I want to test that quick and then I'll try it the other way. |
I also ran into this problem with a brand new Server 2016 Core box and removing the domain credential did the trick. Thanks @oradcliffe |
@alexaymonier What do you mean remove the domain credential? Like removed it from protected settings or? |
I'm refactoring this thing so it can be deployable with an Azure button and it's making me rethink this again haha. |
I think I'm having the same issue. I'm use Lability to build a lab environment and when a member server tries to domain join using DSC it just sits there forever. If i stop the server manually and log into the server the Lability bootstrap log states: Could not find domain. Looking into the error I tried pasting in the commands from the Get-Domain function into a PowerShell window (with appropriate variable values). When I pass in the commands without domain credentials it finds the domain OK. However when I pass in valid domain credentials the error message is returned "current security context is not associated with an active directory domain" from the command $domain = ([System.DirectoryServices.ActiveDirectory.DomainController]::FindOne($context)).domain.ToString() and so it never finds a domain and therefore it can never join it. Like the others in this thread I'm trying without domain credentials now to see if that cures domain join. |
@andyrdavidson In what format are you passing in the username part of the PS - Thanks for trying out Lability 😉. |
@iainbrighton I tried passing in PSCredential object if I remember right (I've slept since then ;-)). The function works just fine if the virtual machine is already a domain member, it seems to fail only when the virtual machine isn't joined to a domain. In which case I guess you shouldn't be passing in the domain credentials anyway! Removing the credentials works just fine. So that's what I'm now doing - I learnt something! :-) I mention it so that you can see the error message - maybe it could quit the function? if it receives that error code because no matter how many times it retries it won't ever find a domain in those circumstances. P.S. You're welcome - fabulous system. Although I'm still getting my head round all of it. :-) |
OK, so been using this resource for ages in our dsc scripts to deploy Server 2012R2 DCs. We're testing moving our DC deployments over to Server 2016 and now the WaitforADDomain resource fails on the second DC. I read through this entire thread trying the various suggestions to get this to work but still no luck. Not sure why simply changing the deployment image to 2016 breaks this but probably something to do with added security in Server 2016. I tried running the commands manually as @andyrdavidson did on the second machine that is attempting to become a DC and with and without credentials fails. I'm going to try joining the machine to the domain first using the domain join extension as that seems it should work but if anyone could explain why this works without issue on 2012R2 but not on 2016 I would appreciate it. |
Hi folks, What's the latest on this one. I ran into this today with a fresh build of a DC on 2016. We were on 2.16.0.0. Thanks. |
I'm facing this issue too. During the setup of a DC the following message appears:
The Domain was provisioned successfully. WIN2016, xActiveDirectory 2.16.0.0 via AzureAutomation |
Yeah, adding my 'plus one' to this issue. |
+1 here. Exact same behavior here with 2016 core. First DC no problem, second DC has the same Set-target resource error as above. |
It looks like there may be a DNS requirement for |
has anyone be able to make this work? I have the same issue with a template in Windows Server 2016. {"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"Conflict","message":"{\r\n "status": "Failed",\r\n "error": {\r\n "code": "ResourceDeploymentFailure",\r\n "message": "The resource operation completed with terminal provisioning state 'Failed'.",\r\n "details": [\r\n {\r\n "code": "VMExtensionProvisioningError",\r\n "message": "VM has reported a failure when processing extension 'configureController'. Error message: "DSC Configuration 'VDIServerIndependent' completed with error(s). Following are the first few: PowerShell DSC resource MSFT_xWaitForADDomain failed to execute Set-TargetResource functionality with error message: Domain mydomain.local not found after 0 attempts with 0 sec interval The SendConfigurationApply function did not succeed."."\r\n }\r\n ]\r\n }\r\n}"}]} |
@gesandovalr I did get this to work. I wish I could say what the silver bullett was because I addressed a number of things but I will list them here. Also, full disclosure, I am using this in Azure so I may have faced some different issues compared to others:
After I addressed these items |
I'll give it try tomorrow, I'm trying to deploy something very simple https://github.com/citrix/Citrix-Cloud-VDI-ARM-Template I read the readme.md that this guy had and I didn't saw the part of an automation account was required. Thanks. |
Looks like he is building the automation credential object himself. If you're deploying to Azure it becomes fairly simple in your script to get the credential if you have it stored in an automation account already vs building the object yourself by using
|
I'm creating the credentials first with the Automation Account if doesn't work, I'll proceed to change the code. |
I am using
I have found adding
to my powershell some makes this work. |
This resource has been refactored in PR #455 which will be merged shortly and available in the next release in a week or so. If there are still issues using the refactored resource in the module ActiveDirectoryDsc, then please submit a new issue so the community can get the configuration used and the verbose logs together with the error that is occurring. I'm closing this issue at this time. |
$domain = Get-Domain -DomainName $DomainName -DomainUserCredential $DomainUserCredential
Should this be Get-ADDomain?
Get-ADDomain -Identity?
I am trying to figure out why deploying DSC configured AD with Azure template keeps failing on the wait for AD domain when it's there, but it says "MSFT_xWaitForADDomain failed to execute Set-TargetResource functionality with error message: Domain NOT found..."
The text was updated successfully, but these errors were encountered: