Campaign Optimization - Predicting How and When to Contact Leads

Setup for Local Code Execution

You can execute code on your local computer and push the computations to the SQL Server on the VM that was created by the ‘Deploy to Azure’ button. But first you must perform the following steps.

On the VM: Configure VM for Remote Access

Connect to the VM to perform the following steps.

You must open the Windows firewall on the VM to allow a connection to the SQL Server. To open the firewall, execute the following command in a PowerShell window on the VM:

netsh advfirewall firewall add rule name="SQLServer" dir=in action=allow protocol=tcp localport=1433 

SQL Server on the VM has been set up with the username and password you specified when you deployed the VM. If you would like to change the password, log into SSMS with Windows Authentication and execute a query such as the following:

    ALTER LOGIN yourusername WITH PASSWORD = 'newpassword';  

On your local computer: Install R Client and Obtain Code

Perform these steps on your local computer.

If you use your local computer you will need to have a copy of R Client on your local machine. If you use Visual Studio, you can add R Tools for Visual Studio. Otherwise you might want to try R Studio.

Also, on your local computer you will need a copy of the solution code. Open a PowerShell window, navigate to the directory of your choice, and execute the following command:

git clone https://github.com/Microsoft/r-server-campaign-optimization.git campaign

This will create a folder campaign containing the full solution package.

Finally, in the sql_connection.R file, replace localhost in the connection_string with the DNS of the VM followed by “,1433”.

Return to Typical Workflow for ‘Deploy to Azure’ Deployment