Add Azure version of webserver
Initial example using Azure package.  Similar to the webserver example, but with differences related to how Azure manages VMs.
ADD
webserver-azure/.gitignore
+/.pulumi/
+/bin/
+/node_modules/
+/yarn.lock
+/package-lock.json
+/Pulumi.*.yaml

ADD
webserver-azure/Pulumi.yaml
+name: webserver-azure
+runtime: nodejs
+description: Basic example of an Azure web server accessible over HTTP.

ADD
webserver-azure/README.md
+# Pulumi web server (Azure)
+
+Starting point for building the Pulumi web server sample in Azure.
+
+## Running the App
+
+Create a new stack:
+
+```
+$ pulumi stack init --local
+Enter a stack name: testing
+```
+
+Configure the app deployment:
+
+```
+$ pulumi config set azure:environment public
+$ pulumi config set username testuser
+$ pulumi config set --secret password <yourpassword>
+```
+
+Login to Azure CLI (you will be prompted to do this during deployment if you forget):
+
+```
+$ az login
+```
+
+Preview the deployment of the application:
+
+```
+$ pulumi preview
+Previewing changes:
+[76 lines elided...]
+info: 7 changes previewed:
+ + 7 resources to create
+```
+
+Perform the deployment:
+
+```
+$ pulumi update
+Performing changes:
+[135 lines elided...]
+info: 7 changes performed:
+ + 7 resources created
+Update duration: 2m38.391208237s
+```
+
+Check the IP address:
+
+```
+$ pulumi stack output privateIP
+10.0.2.4
+```
+
+*TODO*: Expose the Public IP address as well so that the VM can be SSH'd into or CURL'd directly.

ADD
webserver-azure/index.js
+"use strict";
+
+const pulumi = require("@pulumi/pulumi");
+const azure = require("@pulumi/azure");
+
+let config = new pulumi.Config("webserver-azure");
+let username = config.require("username");
+let password = config.require("password");
+
+let resourceGroup = new azure.core.ResourceGroup("server", {
+ location: "West US",
+});
+
+let network = new azure.network.VirtualNetwork("server-network", {
+ resourceGroupName: resourceGroup.name,
+ location: resourceGroup.location,
+ addressSpaces: ["10.0.0.0/16"],
+ // Workaround two issues:
+ // (1) The Azure API recently regressed and now fails when no subnets are defined at Network creation time.
+ // (2) The Azure Terraform provider does not return the ID of the created subnets - so this cannot actually be used.
+ subnets: [{
+ name: "default",
+ addressPrefix: "10.0.1.0/24",
+ }],
+});
+
+let subnet = new azure.network.Subnet("server-subnet", {
+ resourceGroupName: resourceGroup.name,
+ virtualNetworkName: network.name,
+ addressPrefix: "10.0.2.0/24",
+});
+
+let publicIP = new azure.network.PublicIp("server-ip", {
+ resourceGroupName: resourceGroup.name,
+ location: resourceGroup.location,
+ publicIpAddressAllocation: "Dynamic",
+});
+
+let networkInterface = new azure.network.NetworkInterface("server-nic", {
+ resourceGroupName: resourceGroup.name,
+ location: resourceGroup.location,
+ ipConfigurations: [{
+ name: "webserveripcfg",
+ subnetId: subnet.id,
+ privateIpAddressAllocation: "Dynamic",
+ publicIpAddressId: publicIP.id,
+ }],
+});
+
+let userData =
+`#!/bin/bash
+nohup python -m SimpleHTTPServer 80 &`;
+
+let vm = new azure.compute.VirtualMachine("server-vm", {
+ resourceGroupName: resourceGroup.name,
+ location: resourceGroup.location,
+ networkInterfaceIds: [networkInterface.id],
+ vmSize: "Standard_A0",
+ deleteDataDisksOnTermination: true,
+ deleteOsDiskOnTermination: true,
+ osProfile: {
+ computerName: "hostname",
+ adminUsername: username,
+ adminPassword: password,
+ customData: userData,
+ },
+ osProfileLinuxConfig: {
+ disablePasswordAuthentication: false,
+ },
+ storageOsDisk: {
+ createOption: "FromImage",
+ name: "myosdisk1",
+ },
+ storageImageReference: {
+ publisher: "canonical",
+ offer: "UbuntuServer",
+ sku: "16.04-LTS",
+ version: "latest",
+ },
+});
+
+// Note - due to a bug in the terraform-provider-azurerm, the public IP address is not yet populated corerctly.
+exports.publicIP = publicIP.ipAddress;
+exports.privateIP = networkInterface.privateIpAddress;

ADD
webserver-azure/package.json
+{
+ "name": "webserver-azure",
+ "version": "0.1.0",
+ "main": "index.js",
+ "dependencies": {
+ "@pulumi/pulumi": "^0.11.0",
+ "@pulumi/azure": "^0.11.0"
+ }
+}

Add Azure version of webserver

Initial example using Azure package.  Similar to the webserver example, but with differences related to how Azure manages VMs.