Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
161 lines (160 sloc) 6.16 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountPrefix": {
"type": "string",
"metadata": {
"description": "Storage account naming prefix"
}
},
"storageAccountType": {
"type": "string",
"defaultValue": "Standard_LRS",
"allowedValues": [
"Standard_LRS",
"Standard_GRS"
],
"metadata": {
"description": "Storage account type"
}
},
"uploadFileShareName": {
"type": "string",
"defaultValue": "sftpfileshare",
"metadata": {
"description": "Name of file share to be created"
}
},
"sftpUser": {
"type": "string",
"defaultValue": "sftp",
"metadata": {
"description": "Username to use for SFTP access"
}
}
},
"variables": {
"cliContainerName": "create-share",
"cliContainerGroupName": "create-share-group",
"cliContainerImage": "microsoft/azure-cli:latest",
"sftpContainerName": "sftp",
"sftpContainerGroupName": "sftp-group",
"sftpContainerImage": "atmoz/sftp:latest",
"sftpEnvVariable": "[concat(parameters('sftpUser'), '::1001')]",
"storageAccountName": "[concat(parameters('storageAccountPrefix'), uniqueString(resourceGroup().id))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"name": "stg-deployment",
"apiVersion": "2015-01-01",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "https://raw.githubusercontent.com/bhummerstone/azure-templates/master/compute/sftp/stg-share-config-file.json",
"contentVersion": "1.0.0.0"
},
"parameters": {
"storageAccountName": {
"value": "[variables('storageAccountName')]"
},
"storageAccountType": {
"value": "[parameters('storageAccountType')]"
},
"sshKeyFileShareName": {
"value": "[parameters('sftpUser')]"
},
"uploadFileShareName": {
"value": "[parameters('uploadFileShareName')]"
}
}
}
},
{
"type": "Microsoft.ContainerInstance/containerGroups",
"name": "[variables('sftpContainerGroupName')]",
"apiVersion": "2018-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"stg-deployment"
],
"properties": {
"containers": [
{
"name": "[variables('sftpContainerName')]",
"properties": {
"image": "[variables('sftpContainerImage')]",
"environmentVariables": [
{
"name": "SFTP_USERS",
"value": "[variables('sftpEnvVariable')]"
}
],
"resources": {
"requests": {
"cpu": 1,
"memoryInGB": 1
}
},
"ports": [
{
"port": 22
}
],
"volumeMounts": [
{
"mountPath": "[concat('/home/', parameters('sftpUser'), '/upload')]",
"name": "sftpvolume",
"readOnly": false
},
{
"mountPath": "[concat('/home/', parameters('sftpUser'), '/.ssh/keys')]",
"name": "sshkeyvolume",
"readOnly": true
}
]
}
}
],
"osType": "Linux",
"ipAddress": {
"type": "Public",
"ports": [
{
"protocol": "TCP",
"port": 22
}
]
},
"restartPolicy": "OnFailure",
"volumes": [
{
"name": "sftpvolume",
"azureFile": {
"readOnly": false,
"shareName": "[parameters('uploadFileShareName')]",
"storageAccountName": "[variables('storageAccountName')]",
"storageAccountKey": "[reference('stg-deployment').outputs.storageKey.value]"
}
},
{
"name": "sshkeyvolume",
"azureFile": {
"readOnly": false,
"shareName": "[parameters('sftpUser')]",
"storageAccountName": "[variables('storageAccountName')]",
"storageAccountKey": "[reference('stg-deployment').outputs.storageKey.value]"
}
}
]
}
}
],
"outputs": {
"containerIPv4Address": {
"type": "string",
"value": "[reference(concat('Microsoft.ContainerInstance/containerGroups/', variables('sftpContainerGroupName'))).ipAddress.ip]"
}
}
}
You can’t perform that action at this time.