TODO: This is little more than a random brain dump. Needs to be converted into a better blog post.

  • Build and deploy a Node.js application to an Azure Cloud Service
  • Create a Node.js web app in Azure

  • <USERNAME> : a_username
  • <PASSWORD> : long-&-secure
az login

Then do the To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code DEADBEEF to authenticate. dance

[
  {
    "cloudName": "AzureCloud",
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
    "isDefault": true,
    "name": "A DEVELOPER",
    "state": "Enabled",
    "tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
    "user": {
      "name": "username@exmaple.com",
      "type": "user"
    }
  }
]
az webapp deployment user set --user-name a_username --password DEADBEEF
az group create --name the_poc_system --location uksouth
az appservice plan create --name the_poc_system_ServicePlan --resource-group the_poc_system --sku FREE
az webapp create --name poc-system --resource-group the_poc_system --plan the_poc_system_ServicePlan
az webapp deployment source config-local-git --name poc-system --resource-group the_poc_system --query url --output tsv
git remote add azure https://a_username@poc-system.scm.azurewebsites.net/poc-system.git
git push azure master

and

az login
395  az webapp deployment user show
396  az webapp deployment user set --user-name a_username --password DEADBEEF
397  az group create --name poc_wf_static --location uksouth
398  az appservice plan create --name poc_wf_static_ServicePlan --resource-group poc_wf_static --sku FREE
399  az webapp create --name poc-wf --resource-group poc_wf_static --plan poc_wf_static_ServicePlan
400  az webapp deployment source config-local-git --name poc-wf --resource-group poc_wf_static --query url --output tsv
401  git remote add azure https://a_username@poc-wf.scm.azurewebsites.net/poc-wf.git
402  cd git
403  mkdir poc-wf
404  cd poc-wf
405  git init
406  git remote add azure https://a_username@poc-wf.scm.azurewebsites.net/poc-wf.git
407  git push azure master
az webapp deployment user set --user-name <USERNAME> --password <PASSWORD>
[
  {
    "cloudName": "AzureCloud",
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
    "isDefault": true,
    "name": "A DEVELOPER",
    "state": "Enabled",
    "tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
    "user": {
      "name": "username@emaple.com.com",
      "type": "user"
    }
  }
]
{
  "id": null,
  "kind": null,
  "location": null,
  "name": "web",
  "publishingPassword": null,
  "publishingPasswordHash": null,
  "publishingPasswordHashSalt": null,
  "publishingUserName": "a_username",
  "tags": null,
  "type": "Microsoft.Web/publishingUsers/web",
  "userName": null
}
az group create --name the_poc_system --location uksouth
{
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system",
  "location": "westeurope",
  "managedBy": null,
  "name": "the_poc_system",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null
}
az appservice plan create --name the_poc_system_ServicePlan --resource-group the_poc_system --sku FREE
{
  "adminSiteName": null,
  "appServicePlanName": "the_poc_system_ServicePlan",
  "geoRegion": "West Europe",
  "hostingEnvironmentProfile": null,
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/serverfarms/the_poc_system_ServicePlan",
  "kind": "app",
  "location": "West Europe",
  "maximumNumberOfWorkers": 1,
  "name": "the_poc_system_ServicePlan",
  "numberOfSites": 0,
  "perSiteScaling": false,
  "provisioningState": "Succeeded",
  "reserved": false,
  "resourceGroup": "the_poc_system",
  "sku": {
    "capabilities": null,
    "capacity": 0,
    "family": "F",
    "locations": null,
    "name": "F1",
    "size": "F1",
    "skuCapacity": null,
    "tier": "Free"
  },
  "status": "Ready",
  "subscription": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
  "tags": null,
  "targetWorkerCount": 0,
  "targetWorkerSizeId": 0,
  "type": "Microsoft.Web/serverfarms",
  "workerTierName": null
}
az webapp create --name poc-system --resource-group the_poc_system --plan the_poc_system_ServicePlan
{
  "availabilityState": "Normal",
  "clientAffinityEnabled": true,
  "clientCertEnabled": false,
  "cloningInfo": null,
  "containerSize": 0,
  "dailyMemoryTimeQuota": 0,
  "defaultHostName": "poc-system.azurewebsites.net",
  "enabled": true,
  "enabledHostNames": [
    "poc-system.azurewebsites.net",
    "poc-system.scm.azurewebsites.net"
  ],
  "ftpPublishingUrl": "ftp://waws-prod-am6-653.ftp.azurewebsites.windows.net/site/wwwroot",
  "gatewaySiteName": null,
  "hostNameSslStates": [
    {
      "hostType": "Standard",
      "name": "poc-system.azurewebsites.net",
      "sslState": "Disabled",
      "thumbprint": null,
      "toUpdate": null,
      "virtualIp": null
    },
    {
      "hostType": "Repository",
      "name": "poc-system.scm.azurewebsites.net",
      "sslState": "Disabled",
      "thumbprint": null,
      "toUpdate": null,
      "virtualIp": null
    }
  ],
  "hostNames": [
    "poc-system.azurewebsites.net"
  ],
  "hostNamesDisabled": false,
  "hostingEnvironmentProfile": null,
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/sites/poc-system",
  "isDefaultContainer": null,
  "kind": "app",
  "lastModifiedTimeUtc": "2017-08-23T08:23:26.843000",
  "location": "West Europe",
  "maxNumberOfWorkers": null,
  "microService": null,
  "name": "poc-system",
  "outboundIpAddresses": "104.45.14.250,104.45.14.251,104.45.14.252,104.45.14.253",
  "premiumAppDeployed": null,
  "repositorySiteName": "poc-system",
  "reserved": false,
  "resourceGroup": "the_poc_system",
  "scmSiteAlsoStopped": false,
  "serverFarmId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/serverfarms/the_poc_system_ServicePlan",
  "siteConfig": null,
  "slotSwapStatus": null,
  "state": "Running",
  "suspendedTill": null,
  "tags": null,
  "targetSwapSlot": null,
  "trafficManagerHostNames": null,
  "type": "Microsoft.Web/sites",
  "usageState": "Normal"
}

https://poc-system.azurewebsites.net

az webapp deployment source config-local-git --name poc-system --resource-group the_poc_system --query url --output tsv

https://a_username@poc-system.scm.azurewebsites.net/poc-system.git

git remote add azure https://a_username@poc-system.scm.azurewebsites.net/poc-system.git
git push azure master
Password for 'https://a_username@poc-system.scm.azurewebsites.net': <PASSWORD>

az webapp deployment user set --user-name a_username --password <PASSWORD>
{
  "id": null,
  "kind": null,
  "location": null,
  "name": "web",
  "publishingPassword": null,
  "publishingPasswordHash": null,
  "publishingPasswordHashSalt": null,
  "publishingUserName": "a_username",
  "tags": null,
  "type": "Microsoft.Web/publishingUsers/web",
  "userName": null
}
az group create --name the_poc_system --location westeurope
{
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system",
  "location": "westeurope",
  "managedBy": null,
  "name": "the_poc_system",
  "properties": {
    "provisioningState": "Succeeded"
  },
  "tags": null
}
az appservice plan create --name the_poc_system_ServicePlan --resource-group the_poc_system --sku FREE
{
  "adminSiteName": null,
  "appServicePlanName": "the_poc_system_ServicePlan",
  "geoRegion": "West Europe",
  "hostingEnvironmentProfile": null,
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/serverfarms/the_poc_system_ServicePlan",
  "kind": "app",
  "location": "West Europe",
  "maximumNumberOfWorkers": 1,
  "name": "the_poc_system_ServicePlan",
  "numberOfSites": 0,
  "perSiteScaling": false,
  "provisioningState": "Succeeded",
  "reserved": false,
  "resourceGroup": "the_poc_system",
  "sku": {
    "capabilities": null,
    "capacity": 0,
    "family": "F",
    "locations": null,
    "name": "F1",
    "size": "F1",
    "skuCapacity": null,
    "tier": "Free"
  },
  "status": "Ready",
  "subscription": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
  "tags": null,
  "targetWorkerCount": 0,
  "targetWorkerSizeId": 0,
  "type": "Microsoft.Web/serverfarms",
  "workerTierName": null
}
az webapp create --name poc-system --resource-group the_poc_system --plan the_poc_system_ServicePlan
{
  "availabilityState": "Normal",
  "clientAffinityEnabled": true,
  "clientCertEnabled": false,
  "cloningInfo": null,
  "containerSize": 0,
  "dailyMemoryTimeQuota": 0,
  "defaultHostName": "poc-system.azurewebsites.net",
  "enabled": true,
  "enabledHostNames": [
    "poc-system.azurewebsites.net",
    "poc-system.scm.azurewebsites.net"
  ],
  "ftpPublishingUrl": "ftp://waws-prod-am6-653.ftp.azurewebsites.windows.net/site/wwwroot",
  "gatewaySiteName": null,
  "hostNameSslStates": [
    {
      "hostType": "Standard",
      "name": "poc-system.azurewebsites.net",
      "sslState": "Disabled",
      "thumbprint": null,
      "toUpdate": null,
      "virtualIp": null
    },
    {
      "hostType": "Repository",
      "name": "poc-system.scm.azurewebsites.net",
      "sslState": "Disabled",
      "thumbprint": null,
      "toUpdate": null,
      "virtualIp": null
    }
  ],
  "hostNames": [
    "poc-system.azurewebsites.net"
  ],
  "hostNamesDisabled": false,
  "hostingEnvironmentProfile": null,
  "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/sites/poc-system",
  "isDefaultContainer": null,
  "kind": "app",
  "lastModifiedTimeUtc": "2017-08-23T08:23:26.843000",
  "location": "West Europe",
  "maxNumberOfWorkers": null,
  "microService": null,
  "name": "poc-system",
  "outboundIpAddresses": "104.45.14.250,104.45.14.251,104.45.14.252,104.45.14.253",
  "premiumAppDeployed": null,
  "repositorySiteName": "poc-system",
  "reserved": false,
  "resourceGroup": "the_poc_system",
  "scmSiteAlsoStopped": false,
  "serverFarmId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx/resourceGroups/the_poc_system/providers/Microsoft.Web/serverfarms/the_poc_system_ServicePlan",
  "siteConfig": null,
  "slotSwapStatus": null,
  "state": "Running",
  "suspendedTill": null,
  "tags": null,
  "targetSwapSlot": null,
  "trafficManagerHostNames": null,
  "type": "Microsoft.Web/sites",
  "usageState": "Normal"
}
az webapp deployment source config-local-git --name poc-system --resource-group the_poc_system --query url --output tsv
https://a_username@poc-system.scm.azurewebsites.net/poc-system.git
git remote add azure https://a_username@poc-system.scm.azurewebsites.net/poc-system.git
git push azure master

To https://poc-system.scm.azurewebsites.net/poc-system.git
 * [new branch]      master -> master

git push azure master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 325 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '1b45d93c0b'.
remote: Generating deployment script.
remote: Running deployment command...
remote: Handling node.js deployment.
remote: KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
remote: Copying file: 'index.js'
remote: Copying file: 'node_modules\.bin\mime'
remote: Copying file: 'node_modules\.bin\static'
remote: Using start-up script index.js from package.json.
remote: Generated web.config.
remote: The package.json file does not specify node.js engine version constraints.
remote: The node.js application will run with the default node.js version 0.10.28.
remote: Selected npm version 1.4.9
remote: npm WARN package.json @ No repository field.
remote: Finished successfully.
remote: Running post deployment command(s)...
remote: Deployment successful.
To https://poc-system.scm.azurewebsites.net/poc-system.git
   1b45d93..1b45d93  master -> master