2017-05-02 10 views
0

私はPowrshell Galleryに公開されているモジュールを持っています。このモジュールをAzure ARMテンプレートと共に展開したいと思います。そして私はどのように見つけられませんでした!Azure ARMテンプレートとPowerShellモジュール

ここに私のテンプレート:

"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のために提供する必要がありますか?

答えて

2

私は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'))]" 
      ] 
     }, 
+0

はうれしいです。他のコミュニティメンバーが恩恵を受けるように、回答としてマークしてください。 –

+0

伝説、ありがとう。 –

1

我々は、次のいずれかの方法を使用してAzureのオートメーションにこれらの統合モジュールをインポートすることができます。

AzureRm.Automationモジュールで新-AzureRmAutomationModuleコマンドレットを1.Using。
2. Azureポータルを使用して、自動化アカウント内の資産にナビゲートします。
3.Using Azureのリソースマネージャ(ARM)テンプレート

当社は、カスタム統合モジュールを展開するARMのテンプレートを使用することができます。 ARMのテンプレートを使用して、カスタムAzureのオートメーションの統合モジュールを展開

"$schema": "http://schemas.microsoft.org/azure/deploymentTemplate?api-version=2015-01-01-preview#", 
     "contentVersion": "1.0", 
     "parameters": { 
     "automationAccountType": { 
      "type": "string", 
      "allowedValues": [ 
      "New", 
      "Existing" 
      ] 
     }, 
     "automationAccountName": { 
      "type": "string" 
     }, 
     "moduleName": { 
      "type": "string" 
     }, 
     "moduleUri":{ 
      "type": "string" 
     } 
     }, 
     "variables": { 
     "templatelink": "[concat('https://devopsgallerystorage.blob.core.windows.net/azureautomationpackages/templates%5Corigtemplates%5C', parameters('automationAccountType'), 'AccountTemplate.json')]" 
     }, 
     "resources": [ 
     { 
      "apiVersion": "2015-01-01", 
      "name": "nestedTemplate", 
      "type": "Microsoft.Resources/deployments", 
      "properties": { 
      "mode": "incremental", 
      "templateLink": { 
       "uri": "[variables('templatelink')]", 
       "contentVersion": "1.0" 
      }, 
      "parameters": { 
       "accountName": { 
       "value": "[parameters('automationAccountName')]" 
       }, 
       "accountLocation": { 
       "value": "[resourceGroup().Location]" 
       }, 
       "moduleName": { 
       "value": "[parameters('moduleName')]" 
       }, 
       "moduleUri": { 
       "value": "[parameters('moduleUri')]" 
       } 
      } 
      } 
     } 
     ] 
    } 

詳しい情報は、Ravikanthでwritedこのlinkを参照してください。ここでは例のテンプレートです。

関連する問題