chef / knife-azure

Chef knife plug-in for Microsoft Azure
https://github.com/chef/knife-azure
Apache License 2.0
72 stars 89 forks source link

401 when provisioning windows VMs #49

Closed phoellig closed 9 years ago

phoellig commented 11 years ago

This is probably a configuration issue rather than a bug, but I've followed the docs as best I can and am having some trouble provisioning windows VMs, linux ones work fine.

I'm using 1.2.0, which I checked out and built a few days back (Thursday, I believe).

I created a windows VM in Azure, followed the docs on the knife-windows project to configure winrm (re: ran all of the commands that are shown there), ran sysprep on the machine, and captured an image from it.

Then I configure my knife.rb with my subscription and cert info (which works since I can provision linux VMs fine) and feed that image to the knife azure server create command as follows:

knife azure -VV server create --azure-service-location 'West US' --winrm-user myusername --winrm-password password123? --azure-source-image quickchef-windows2008 --azure-dns-name winChef1234 --azure-vm-size Small --azure-storage-account myvmstorage --template-file windows-template.erb

The VM gets created with the WinRM endpoint and then fails to connect with a 401. I'm guessing it's a azure/winrm/sysprep issue, but there isn't really documentation that I've been able to find discussing it. Here is the long output from the command that I've run https://gist.github.com/sethvargo/5980750

Thanks!

(I moved the stacktrace to a gist to improve readability - @sethvargo)

muktaa commented 11 years ago

Please check the username and password for the windows image. You must give that as the --winrm-username and --winrm-password. Let me know this helps.

phoellig commented 11 years ago

I created a new image and retested to make sure I had the credentials mirrored and the error persists. I also tried providing the username as machinename\username in case it was a domain issue, but that didn't help. I'm a little surprised that the credentials need to match the ones from the VM the image was created with since you normally provide new credentials each time you create a VM based on an image. It doesn't seem to be the source of my issue though.

phoellig commented 11 years ago

So I've managed to get it to work by setting "--winrm-user Administrator". I didn't use Administrator for the user in the base image, any other username that I've tried fails with the 401.

While this is open, I see in the code that ssh bootstrapping is supported for windows VMs. Am I correct in thinking that the base image would have to be configured as an SSH server that starts on boot and listens on --ssh-port?

muktaa commented 11 years ago

Yes. Thats right.

sethvargo commented 11 years ago

Hey @phoellig! Thank you for supporting this Opscode knife plugin! Our process has a couple prerequisites before we can merge your contribution. We need to ensure you've completed a Contributor License Agreement (CLA) and a ticket on our ticket tracker for the release workflow. I looked, but I could not find one under your name. Pull requests are optional, but should always include the ticket number that they're related to for cross-referencing. Please take a moment to review the below wiki page for the appropriate steps:

Please feel free to ping me if you have any questions :smile:

phoellig commented 11 years ago

@sethvargo The CLA is in the process of getting set up with my company (PROS Inc.) at the moment. Hopefully that will move through relatively soon and I can start getting some fixes and enhancements back into the main line.

sethvargo commented 11 years ago

@phoellig okay sounds good! I moved your stacktrace to a gist to cleanup the description a bit

siddheshwar-more commented 9 years ago

@phoellig Seems this issue is resolved.