In this tutorial:
Windows Azure Web Sites
Windows Azure Web Sites is a platform-as-a-service (PaaS) solution for hosting your .NET, PHP, Ruby, Python or node.js application. With Windows Azure Web Sites you can deploy directly from your source code repository. Continuous integration and automated deployment can be done from the Git repository of your choice or by connecting your GitHub or BitBucket projects. In this tutorial, we'll set up a Windows Azure Web Site and we'll deploy to it directly from PhpStorm.
Setting up a Windows Azure Web Site
Let's first set up a Windows Azure Web Site real quickly. If this is the first time you hear about Web Sites and want more detail on getting started, check the Windows Azure website for a detailed step-by-step explanation.
From the management portal, click the New | Compute | Web Site | Quick Create menu and create a new web site. Specify a URL and select the datacenter location where we want to be hosted. Clicking Create will provision a new Windows Azure Web Site.
Next, make sure Git support is enabled. From our newly created web site, click Enable Git publishing. This will create a new Git repository for our web site.
We can now opt to "Deploy from GitHub", which will link the web site to a project on GitHub and deploys fresh code on every change on a specific branch. It's very easy to do that, but we'll be taking the other option: let's use our Windows Azure Web Site as a Git repository instead.
Creating a PhpStorm project
After starting PhpStorm, go to VCS | Checkout from Version Control | Git. As the repository URL, enter the repository that is listed in the Windows Azure management portal. It's probably similar to https://@.scm.azurewebsites.net/.git.
Once that's done we can click the Clone button. PhpStorm will ask for credentials after which it will download the contents of our Windows Azure Web Site. In this tutorial, we started from an empty web site but if we would have started with creating a web site from gallery, PhpStorm would simply download the entire web site's contents. After the clone operation finishes, this should be our PhpStorm project:
Add a new file by right-clicking the project and clicking New | File. Name the file "index.php" since that is one of the root documents recognized by Windows Azure Web Sites. If PhpStorm proposes to add the file to the Git repository, answer affirmative. This will allow us to deploy the file to Windows Azure Web Sites through Git later on.
The following code can be added as the contents of the index.php file:
We are now set to deploy our application to Windows Azure Web Sites.
Publishing the application to Windows Azure
To commit the changes we've made earlier, press Ctrl+K (Mac: Cmd+K) or use the menu VCS | Commit Changes. This will commit the created and modified files to our local copy of the remote Git repository.
On the Commit button, click the little arrow and select Commit and Push. This will make PhpStorm do two things at once: create a changeset containing our modifications and push it to Windows Azure Web Sites. We'll be asked for a final confirmation:
After having clicked Push, PhpStorm will send our contents to Windows Azure Web Sites and create a new deployment. The Windows Azure management portal immediately reflects this:
Our website will now be up and running at the URL created earlier.
As you can see, deploying a PHP application to Windows Azure Web Sites can be done using PhpStorm's built-in Git support.
Windows Azure command-line tool support
PhpStorm allows us to invoke command line tools from the IDE. Windows Azure has a command line tool named "azure" which allows command line invocation of all actions available through the Windows Azure management portal.
In order to use the Windows Azure command line tools, we'll have to configure PhpStorm with a custom command so that we can invoke these commands from within our IDE. From the File | Settings menu find the Command Line Tool Support pane and add a new framework.
Next, enter the following details. Note that the tool path may be different on your machine. It should be the full path to the command line tools for Windows Azure, which on my machine is C:\Program Files (x86)\Microsoft SDKs\Windows Azure\CLI\0.6.9\wbin\azure.cmd.
After clicking Ok, we can close the settings dialog and return to our working environment. From there, we can open a command line through the Tools | Run Command menu or by simply using the Ctrl+Shift+X (Mac: Cmd+Shift+X) keyboard combination. If we now invoke the "azure" command, we can see the help information provided by the Windows Azure command line tools:
From the Command Line Tools Console pane, we can now invoke commands like azure site create JetBrains --git --location "West US", which will create us a new Windows Azure Web Site named JetBrains in the West US datacenter and with Git support enabled.
For reference, here's the complete list of available commands in the Windows Azure command line tools. A list of useful recipes is available as well.