New Question
0

How to use cloudbase-init for windows azure instance

asked 2020-01-15 20:00:11 +0200

bsharma-2104 gravatar image

updated 2020-01-22 12:46:25 +0200

avladu gravatar image

I am trying to use cloudbase-init for windows azure instance. I created image from a machine with cloudbase-init enabled but can't figure out how to use this image to leverage cloudbase-init features like setting up hostname while starting another instance from this image. Trying out this from azure portal following this tutorial. https://blogs.vmware.com/management/2... Any help would be appreciated.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2020-01-30 09:12:25 +0200

bsharma-2104 gravatar image

Hi. I am able to start cloudbase init on windows 2012 instance and try out different cloudbase init features. But, few challenges I am facing. 1. I want to run one batch file using cloudbase init Userdata plugin. This batch file is present inside my instance. How do I run this batch file specifying details in cloud config script? Tried something like this: runcmd <path of="" batch="" file="" in="" image="">\test.bat

This doesn't work. How do I achieve this?

  1. I want to create a custom Windows 2012 R2 image with cloudbase init enabled using custom cloud config files. Which preexisting template to use? Can you provide more details on how to achieve this using https://github.com/cloudbase/windows-... I can do this manually but my requirement is to achieve the same via code or azure cli.

  2. I want to use cloudbase init password plugin to set some random password. But, the challenge is how do I retrieve this password. Azure doesn't provide any APIs to retrieve this password.

Waiting for your reply on above questions.

edit flag offensive delete link more

Comments

Hello, Here is an example configuration for Cloudbase-Init for Azure: https://github.com/cloudbase/windows-openstack-imaging-tools/tree/master/Examples/config/azure Azure already provides the option to set a password for a custom user when you create the VM. Cloudbase-Init will set the password.

avladu gravatar imageavladu ( 2020-01-31 19:55:17 +0200 )edit

Thanks for the answer. I want to use Cloudbase-Init feature where it sets random password using inject_user_password = false. In my case, it sets the password but I don't know how to retrieve that password. Also, couuld you please answer my initial question related to running batch file?

bsharma-2104 gravatar imagebsharma-2104 ( 2020-02-03 07:05:09 +0200 )edit

On the password issue, Azure does not have an API where cloudbase-init can post the password (like OpenStack does, for example). You can only use the feature that Azure provides you: creating a user with a password when you create the instance.

avladu gravatar imageavladu ( 2020-02-03 12:03:41 +0200 )edit

Running commands is currently supported for the beta version of cloudbase-init. Please check https://cloudbase-init.readthedocs.io/en/latest/userdata.html#cloud-config for the supported cloud-config features.

avladu gravatar imageavladu ( 2020-02-03 12:05:01 +0200 )edit

I tried using runcmd as suggested in the above doc. But, it comes as as unsupported command. I am using cloudbase-init beta version only. I am using this command: runcmd: - 'C:\\myBatchFile.bat'

bsharma-2104 gravatar imagebsharma-2104 ( 2020-02-11 08:23:28 +0200 )edit
0

answered 2020-01-22 12:53:03 +0200

avladu gravatar image

Hello,

The tutorial you followed is a great point to start. At what step did you encounter issues?

The image can also be created in your own environment using https://github.com/cloudbase/windows-... with a custom cloudbase-init config file (you can use the ones from the tutorial), then upload the VHD to Azure. Thank you,

Adrian

edit flag offensive delete link more

Comments

I couldn't post entire text here. So, have asked follow-up questions I have in the above answer comment. Please check.

bsharma-2104 gravatar imagebsharma-2104 ( 2020-01-30 09:13:50 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-01-15 20:00:11 +0200

Seen: 2,359 times

Last updated: Jan 30 '20