This is a very cool feature I recently discovered in the Azure portal here. The feature is called Automation Options and it is found next to the Create button on the + New Azure App Service Web App blade, as shown in Figure 1.
Figure 1, auto generate Azure deployment templates
I was only able to find the support for CLI, PowerShell, .NET and Ruby when creating an Azure App Service. I looked at a Cloud Service and although it was there, all of the capabilities did not exist, nor for VMs. Since it is a pretty cool feature, perhaps it is in the works.
This reminds me a lot of the Generate Script feature in the IIS management console that I call out here in Figure 9.
Nonetheless, it is a cool feature that needs acknowledgment. Also see that there is a link to an article about deploying resources using resource manager templates and PowerShell. So once you get the deployment template, I suggest you read this article and learn how to make the deployment using that template.