If you want to make end to end automation in Azure. You need to attach some sort of script after the vm finished provisioning.
There are different status while you creating vm. You dont want to send a script when the server is provisioning.
You can use the following PowerShell script to detect the vm is finished provisioning, and start you script afterwards.
while ((Get-AzureVM -ServiceName $ServiceName -Name $using:vmname).InstanceStatus -ne 'ReadyRole')
Get-AzureVM -ServiceName $ServiceName -Name $using:vmname
Write-output 'Try again in 45 seconds'
Start-Sleep -Seconds 45
Start-Sleep -Seconds 1
Write-output 'Server status is ReadyRole now.'
#Start your custom script from here.