New Question

cloudbase-init config script works inconsistently using azure shared gallery image and azure java client

asked 2020-02-27 08:59:23 +0300

bsharma-2104 gravatar image

updated 2020-02-27 15:58:14 +0300

avladu gravatar image

I have created a windows 2012 R2 azure image with cloudbase-init installed. My intention is to run a script while starting any new VM instance using this image. My cloud config script contains powershell script basically starting with #ps1sysnative. This has been working fine for a while now.

I have moved my azure base image to shared image gallery. Now, when I am creating an instance using the complete image url of latest image present in shared image gallery, I run into one issue. I am passing the same cloud config script. But, what is happening is that I can start new machine with cloud config script executed during startup while doing so using azure cli but while making create instance call using azure java client (basically method and passing cloud config using, at time cloudbase-init runs the cloud config powershell script but after a while it is not running this script, that custom data is getting dumped into azure machine as customdata.bin. All cofiguration is same and the same flow works if I give the base image id and not the one present in shared gallery.

Cloud-config script is something like this:


$example = ‘test’

(Get-Content -Path C:\testData) |
  ForEach-Object {$_ -Replace ‘{example}‘, $example} |
    Set-Content -Path C:\testData

Not sure why this weird behaviour when using shared gallery image and azure java client. I am not making any changes but running into this weird behaviour. Kindly assist.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2020-02-27 16:03:35 +0300

avladu gravatar image


To better manage this issue and its resolution, can you first open a bug on GitHub ? Please provide, if possible, the cloudbase-init config file and logs there too.

Thank you,
Adrian Vladu

edit flag offensive delete link more


Done. Could you please check and update? I am in the middle of my implementation and because of this inconsistent behaviour, not sure how to proceed.

bsharma-2104 gravatar imagebsharma-2104 ( 2020-02-27 17:49:24 +0300 )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

1 follower


Asked: 2020-02-27 08:59:23 +0300

Seen: 1,217 times

Last updated: Feb 27 '20