ARM模板和PowerShell模块

ARM模板和PowerShell模块

本文介绍了Azure ARM模板和PowerShell模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PowerShell画廊上发布了一个模块,并且我想使用Azure ARM模板部署此模块.而且我没有找到方法!

I have a module published on PowerShell Gallery and I want to deploy this module with Azure ARM Template. And I did not find how!

这是我的模板:

   "resources": [
  {
     "name": "[variables('automationAccountName')]",
     "type": "Microsoft.Automation/automationAccounts",
     "apiVersion": "2015-10-31",
     "location": "[parameters('AutomationLocation')]",
     "tags": {
        "displayName": "Compte Automation"
     },
     "properties": {
        "sku": {
           "name": "Basic",
           "family": "B"
        }
     },
     "resources": [
        {
           "name": "[variables('powerShellGalleryModuleName')]",
           "type": "modules",
           "apiVersion": "2015-10-31",
           "location": "[parameters('AutomationLocation')]",
           "properties": {
              "isGlobal": false,
              "sizeInBytes": 0,
              "contentLink": {
                    "uri": "[variables('powerShellGalleryModule')]"
              }
           }
        }
     ]
  }
]

应为变量powerShellGalleryModule提供什么?

推荐答案

我找到了一种通过PowerShellGallery进行操作的方法

I found a way to do via the PowerShellGallery

这种方式:

            {
           "name": "[variables('powerShellGalleryModule')]",
           "type": "modules",
           "apiVersion": "2015-10-31",
           "location": "[parameters('AutomationLocation')]",
           "properties": {
              "isGlobal": false,
              "sizeInBytes": 0,
              "contentLink": {
                 "uri": "[concat('https://www.powershellgallery.com/api/v2/package/', variables('powerShellGalleryModule'))]"
              }
           },
           "dependsOn": [
              "[resourceId('Microsoft.Automation/automationAccounts', variables('automationAccountName'))]"
           ]
        },

这篇关于Azure ARM模板和PowerShell模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:51