上一篇我們展示了如何透過ARM Template由Azure Gallery所提供的映像建置佈署虛擬機器;我們一樣可以透過同樣的方式來佈署Marketplace中的機器;作法一樣,唯一的不同只有Template File的Schema不同。
以我們的夥伴的Marketplace Offering為例:http://azure.microsoft.com/en-us/marketplace/partners/advantech/susiaccess30-std/
- 首先透過Azure powershell取得Publisher、Offer與Sku
- 接著,修改我們的Template,主要的改變在virtual machines一段
- 在virtual Machnes宣告中,加入plan宣告
1: "plan": {
2: "name": "std",
3: "product": "susiaccess30",
4: "promotionCode": null,
5: "publisher": "advantech"
6: },
- 其中
- name為先前powershell取得的sku
- product為powershell取得的Offer
- publisher為PublisherName
- 如果沒有Promotion Code,這邊填上null
- name為先前powershell取得的sku
- 在virtual Machnes宣告中,加入plan宣告
- 完整的Virtual Machin宣告如下
1: {
2: "apiVersion": "2015-05-01-preview",
3: "type": "Microsoft.Compute/virtualMachines",
4: "name": "susivm",
5: "location": "[resourceGroup().location]",
6: "dependsOn": [
7: "[concat('Microsoft.Storage/storageAccounts/', parameters('storageAccountName'))]",
8: "[concat('Microsoft.Network/networkInterfaces/', 'nicJumpBox')]"
9: ],
10: "plan": {
11: "name": "std",
12: "product": "susiaccess30",
13: "promotionCode": null,
14: "publisher": "advantech"
15: },
16: "properties": {
17: "hardwareProfile": {
18: "vmSize": "[parameters('vmSize')]"
19: },
20: "osProfile": {
21: "computername": "susiaccess",
22: "adminUsername": "[parameters('adminUsername')]",
23: "adminPassword": "[parameters('adminPassword')]"
24: },
25: "storageProfile": {
26: "imageReference": {
27: "publisher": "advantech",
28: "offer": "susiaccess30",
29: "sku": "std",
30: "version": "latest"
31: },
32: "osDisk": {
33: /*"operatingSystemType": "Windows",*/
34: "name": "susiaccess30-osdisk",
35: "vhd": {
36: "uri": "[concat('http://',parameters('storageAccountName'),'.blob.core.windows.net/vhds/','osdisk-vm-test', '.vhd')]"
37: },
38: "caching": "ReadWrite",
39: "createOption": "FromImage"
40: /*,"sourceImage": null*/
41: }
42: },
43: "networkProfile": {
44: "networkInterfaces": [
45: {
46: "properties": {
47: "primary": false
48: },
49: "id": "[resourceId('Microsoft.Network/networkInterfaces','nicJumpBox')]"
50: }
51: ]
52: }
53: }
54: }
- 完整的template在此:https://github.com/michael-chi/ARM-WebServers-with-JumpBox/blob/master/azuredeploy.json
- 也可以透過”Deploy to Azure”按鈕佈署到Azure上!
沒有留言:
張貼留言