Changing Registry settings using a startup task in Azure
> Make the appropriate changes in the registry, and then export the appropriate subkey or subkeys. Exported registry subkeys are automatically saved as .reg files.
- Click Start, click Run, type regedit
in the Open box, and then click OK. - Locate and then click the subkey that holds
the registry item or items that you want to change. - Click File, and then click Export.
This step backs up the subkey before you make any changes. You can import this
file back into the registry later if your changes cause a problem. - In the File name box, type a file name
to use to save the .reg file with the original registry items, and then click Save.
Example :
> Add the exported .reg file (ChangeVersion.reg in this example) to your application and set “Copy to output Directory = Copy always”.
> Create a batch file (ChangeRegistrySetting.cmd in this example) and add to your application.
Right click on the file -> Properties -> set “Copy to output Directory = Copy always”.
ChangeRegistrySetting.cmd
=======================
@echo off
regedit.exe /s ChangeVersion.reg
exit /b 0
> Specify the .cmd file to be executed as a startup task on Azure VM.
Make the necessary changes in ServiceDefinition.csdef file.
> Deploy the application package, RDP to the VM and test.