Hello, @Barak Pahima !
How do I run a script after a VM deployment using the Java SDK?
It looks like you're specifically looking for something that you can use with a Java SDK deployment workflow. You can use custom data and there's a detailed post that goes through what this looks like.
Looking at the Azure Java SDK examples, this is what caught my attention:
// Use a VM extension to install Apache Web servers
.defineNewExtension("CustomScriptForLinux")
.withPublisher("Microsoft.OSTCExtensions")
.withType("CustomScriptForLinux")
.withVersion("1.4")
.withMinorVersionAutoUpgrade()
.withPublicSetting("fileUris", fileUris)
.withPublicSetting("commandToExecute", installCommand)
.attach()
Let me know in the comments if this is useful or if you need additional guidance.