Skip to content

Instantly share code, notes, and snippets.

@brbarnett
Last active March 6, 2019 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brbarnett/7cacd4a30bed946e9ad681c261765fbd to your computer and use it in GitHub Desktop.
Save brbarnett/7cacd4a30bed946e9ad681c261765fbd to your computer and use it in GitHub Desktop.
Web Apps for Containers ARM template deployment
resources:
- repo: self
queue:
name: Hosted Ubuntu 1604
steps:
- task: AzureResourceGroupDeployment@2
displayName: 'Azure Deployment:Create Or Update Resource Group action on My-Resource-Group-XXX-XXX'
inputs:
azureSubscription: DemoSPNConnection
resourceGroupName: 'My-Resource-Group-XXX-XXX' # Fake since this is for validation only
location: 'East US' # Fake since this is for validation only
csmFile: deploy.json
csmParametersFile: deploy.parameters.dev.json
deploymentMode: Validation
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.SourcesDirectory)'
trigger:
batch: true
branches:
include:
- master
paths:
exclude:
- readme.md
resources:
- repo: self
queue:
name: Hosted Ubuntu 1604
steps:
- task: AzureResourceGroupDeployment@2
displayName: 'Azure Deployment:Create Or Update Resource Group action on My-Resource-Group-XXX-XXX'
inputs:
azureSubscription: DemoSPNConnection
resourceGroupName: 'My-Resource-Group-XXX-XXX' # Fake since this is for validation only
location: 'East US' # Fake since this is for validation only
csmFile: deploy.json
csmParametersFile: deploy.parameters.dev.json
deploymentMode: Validation
trigger: none
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dockerRegistryPassword": {
"type": "securestring",
"defaultValue": ""
},
"dockerRegistryUrl": {
"type": "string",
"defaultValue": "<ACR-instance-name>.azurecr.io",
"minLength": 1
},
"dockerRegistryUsername": {
"type": "string",
"defaultValue": "<ACR-instance-name>"
},
"environmentName": {
"type": "string",
"defaultValue": "DEV",
"minLength": 1
},
"appServicePlanInstances": {
"type": "int",
"defaultValue": 1
},
"appServicePlanSku": {
"type": "string",
"defaultValue": "S1",
"minLength": 1
}
},
"variables": {
"appServicePlanName": "[concat('DemoAsp-', parameters('environmentName'))]"
},
"resources": [
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2016-09-01",
"kind": "linux",
"name": "[variables('appServicePlanName')]",
"location": "[resourceGroup().location]",
"properties": {
"numberOfWorkers": "[parameters('appServicePlanInstances')]",
"reserved": true
},
"dependsOn": [],
"sku": {
"name": "[parameters('appServicePlanSku')]"
}
},
{
"comments": "My API",
"type": "Microsoft.Web/sites",
"kind": "app,linux,container",
"apiVersion": "2016-08-01",
"name": "[concat('my-api-', resourceGroup().location, '-', toLower(parameters('environmentName')))]",
"location": "[resourceGroup().location]",
"properties": {
"enabled": true,
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]",
"siteConfig": {
"appSettings": [
{
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
"value": "false"
},
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "[concat('https://', parameters('dockerRegistryUrl'))]"
},
{
"name": "DOCKER_REGISTRY_SERVER_USERNAME",
"value": "[parameters('dockerRegistryUsername')]"
},
{
"name": "DOCKER_REGISTRY_SERVER_PASSWORD",
"value": "[parameters('dockerRegistryPassword')]"
}
],
"appCommandLine": ""
}
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('appServicePlanName'))]"
]
}
]
}
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"dockerRegistryUrl": {
"value": "<ACR-instance-name>.azurecr.io"
},
"dockerRegistryUsername": {
"value": "<ACR-instance-name>"
},
"environmentName": {
"value": "DEV"
},
"primaryAppServicePlanInstances": {
"value": 1
},
"primaryAppServicePlanSku": {
"value": "S1"
}
}
}
@djarvis
Copy link

djarvis commented Mar 6, 2019

I've been trying to do this. The deployment is successful but the "kind" when retrieved is only ever "app" instead of "app,linux,container". Did something change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment