# Capture Image

## 1. Clear old log and temp files

| Windows | Linux
Required: rrService setup files | •Click on the Windows start button, enter "services" and press return to open the service control. •Stop the RoyalRender service. •Open an explorer, browse to the folder C:\Program files\rrService. •Delete the file configExecutedOnce.info | •Execute the commandlines: sudo /etc/init.d/rrCloudService stop sudo rm /usr/local/rrService/configExecutedOnce.info sudo rm -rf /usr/local/rrService/lc64
Required: RR render files | •If the client was running, you HAVE TO delete the folder C:\RR_Locadata | •If the client was running, you HAVE TO delete the folder /usr/local/RR_Localdata. sudo rm -rf /usr/local/RR_Localdata
Recommended: RR service logs | •Click on the Windows start button, enter "services" and press return to open the service control. •Stop the RoyalRender service. •Open an explorer, browse to the folder C:\Program files\rrService. •Delete the log files rrCloudService.log and rrCloudService_Errors.log | •Execute the commandlines: sudo /etc/init.d/rrCloudService stop sudo rm /usr/local/rrService/rrCloudService.log sudo rm /usr/local/rrService/rrCloudService_Errors.log
Stop rrClient | •In case the rrClient is still running, please open the Task Manager, tab details. •Use the button to show all processes, sort the table by name, press 'r' and kill and rrClientconsole processes. | •To shutdown the rrClient if it was started by the Cloud Manager: /usr/local/rrService/lc64/rrClientCommander shutdown
Optional: OS Logs | •Start Powershell and execute wevtutil el | Foreach-Object {wevtutil cl "$_"} | •Execute sudo chmod 777 /var/log/* for i in /var/log/*; do cat /dev/null > $i; done
Optional: Azure Logs | •Start the Task Manager or Service control and stop the RdAgent and 2 Windows Azure .... services. •Open the Explorer and delete all ....log files from c:\WindowsAzure\Logs\ |
Optional: OS Cleanup | •Open the Explorer, Select "This PC" and right-click to open the properties. •Click on the button "Disk CleanUp" on the General tab | •Execute sudo rm -R /tmp/*

## 2. Sysprep and generalize the VM image

This steps removes all personal data and specific hardware information of the machine from the OS.

Windows | Linux
•Right-click on the Windows Start button and choose "Run" or press <windows key>+<R> •Enter %systemroot%\system32\sysprep\sysprep.exe •Choose the option "OOBE", check "Generalize" and choose "Shutdown" and execute it. (Takes ~10 minutes) | •Open a terminal and execute: sudo waagent -deprovision+user •If you like, you can clear your commandline history with the command: export HISTSIZE=0 •logout

•Open this website: https://resources.azure.com

•Deallocate,
Generalize
and Capture the VM.
Tutorial: http://www.codeisahighway.com/how-to-use-arm-explorer-to-capture-your-own-custom-virtual-machine-image-under-azure-resource-manager/

Note:

If you see this message, please restart the VM. Windows Updates are pending. |

## 3. Move the image file

•Download the "Microsoft Azure Storage Explorer" and either add your storages one by one via the storage keys or login with your Azure account to access all storages.

•Either create a new storage via the portal for your finished VM images
or use the one you have created for this VM (If you have not used "II D Modify existing image").

•Open the Blob Container of the storage for the finished VMs
Create a subfolder (container) named "images" as target.

•Open the folder (container) "system" on the storage with the captured VM. Follow the subfolders until you find a file starting with the name you used to capture the VM.
Select the .vhd file (not the other file)

•Press F2 and rename the image to something more simple.
Do not forget the .vhd extension. You are only allowed to use more than one underscore _ . Better use multiple minus - instead.

•Press the copy button in the menu. Browse to the target "images" folder and paste it.

•Wait until the image is copied.

•If you used "IIC Create new image", then cleanup old items:
Delete the VM you created, then delete the NIC and IPs.
At last, either delete the source storage or, if the storage was the target as well, delete all files in the system folder and the vhds folder.

## 4. Source image access rights

There are two options in order to access your source image:

•Grant public read-only access to the "images" folder (A)

•or create an SAS token (B).

A) Grant public access

•Please open Azure Portal.

•Go to storages.

•Select the storage with your source image.

•Select "Blobs" from the right hand side.

•Select folder "images"

•Goto top menu item "Access rights" and select "Blob (anonymous read access for blobs only)".

B) SAS token

•Please open Azure Portal.

•Go to storages.

•Select the storage with your source image.

•Select "Blobs" from the right hand side.

•Select folder "images"

•Goto top menu item "Access rights" and select "Private (no anonymous access)".

•Download the Microsoft Azure Storage Explorer and add your storages via the storage keys or login with your Azure account to access all storages.

•Right-click on the "images" folder and select "Get Shared Access Signature ...".

•Change the start day to yesterday, choose an expiry time and set permissions to "read".

•Click "Create".

•Copy whole "Query" string.

•Open rrConfig and select "Cloud" tab.

•Select your CloudConnector.

•Paste token to vmStorageSasToken.

•Save settings.