Created
September 21, 2018 10:21
-
-
Save johndowns/0f2aab3a1319b6a6da68c0010e974a3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"storageAccountName": { | |
"type": "string", | |
"defaultValue": "[uniqueString(subscription().subscriptionId, resourceGroup().name)]" | |
}, | |
"location": { | |
"type": "string", | |
"defaultValue": "[resourceGroup().location]", | |
"metadata": { | |
"description": "The location in which the Azure Storage and Scheduler resources should be deployed." | |
} | |
}, | |
"queueName": { | |
"type": "string", | |
"defaultValue": "autoposted", | |
"metadata": { | |
"description": "The name of the queue that should have the messages automatically posted to it. The queue will NOT be created by the template deployment." | |
} | |
}, | |
"messageContents": { | |
"type": "string", | |
"defaultValue": "mymessage", | |
"metadata": { | |
"description": "The contents of the message to post to the queue." | |
} | |
}, | |
"postRecurrence": { | |
"type": "object", | |
"defaultValue": { | |
"interval": 1, | |
"frequency": "Minute" | |
}, | |
"metadata": { | |
"description": "The frequency at which the message should be posted to the queue." | |
} | |
}, | |
"storageAccountSasTokenRequest": { | |
"type": "object", | |
"defaultValue": { | |
"signedServices": "q", | |
"signedResourceTypes": "o", | |
"signedPermission": "a", | |
"signedExpiry": "2020-08-20T11:00:00Z" | |
} | |
} | |
}, | |
"variables": { | |
"schedulerJobCollectionName": "QueuePoster", | |
"schedulerJobName": "PostMessage" | |
}, | |
"resources": [ | |
{ | |
"name": "[parameters('storageAccountName')]", | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "2018-02-01", | |
"location": "[parameters('location')]", | |
"sku": { | |
"name": "Standard_LRS" | |
}, | |
"kind": "StorageV2", | |
"properties": { | |
"supportsHttpsTrafficOnly": true, | |
"accessTier": "Hot" | |
} | |
}, | |
{ | |
"name": "[variables('schedulerJobCollectionName')]", | |
"type": "Microsoft.Scheduler/jobCollections", | |
"apiVersion": "2016-03-01", | |
"location": "[parameters('location')]", | |
"properties": { | |
"sku": { | |
"name": "Standard" | |
} | |
}, | |
"resources": [ | |
{ | |
"type": "jobs", | |
"name": "[variables('schedulerJobName')]", | |
"apiVersion": "2016-03-01", | |
"properties": { | |
"state": "Enabled", | |
"action": { | |
"type": "StorageQueue", | |
"queueMessage": { | |
"storageAccount": "[parameters('storageAccountName')]", | |
"queueName": "[parameters('queueName')]", | |
"sasToken": "[listAccountSas(parameters('storageAccountName'), '2018-02-01', parameters('storageAccountSasTokenRequest'))]", | |
"message": "[parameters('messageContents')]" | |
} | |
}, | |
"recurrence": "[parameters('postRecurrence')]" | |
}, | |
"dependsOn": [ | |
"[concat('Microsoft.Scheduler/jobCollections/', variables('schedulerJobCollectionName'))]", | |
"[parameters('storageAccountName')]" | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment