是否可以使用 Azure JSON-View 作为部署脚本的一部分?

问题描述 投票:0回答:2

Azure 新手 - 我手动创建了 azure data Lake gen 2 存储帐户。我单击 JSON 视图图标,然后看到一个 JSON 字符串,其中包含有关存储帐户的所有信息。是否可以使用该 JSON 字符串作为脚本的一部分来创建存储帐户?

azure azure-resource-manager azure-storage-account azure-cloud-shell json-view
2个回答
0
投票

根据this,创建ADLS帐户的ARM模板应采用以下格式:

{
  "type": "Microsoft.DataLakeStore/accounts",
  "apiVersion": "2016-11-01",
  "name": "string",
  "location": "string",
  "tags": {
    "tagName1": "tagValue1",
    "tagName2": "tagValue2"
  },
  "identity": {
    "type": "SystemAssigned"
  },
  "properties": {
    "defaultGroup": "string",
    "encryptionConfig": {
      "keyVaultMetaInfo": {
        "encryptionKeyName": "string",
        "encryptionKeyVersion": "string",
        "keyVaultResourceId": "string"
      },
      "type": "string"
    },
    "encryptionState": "string",
    "firewallAllowAzureIps": "string",
    "firewallRules": [
      {
        "name": "string",
        "properties": {
          "endIpAddress": "string",
          "startIpAddress": "string"
        }
      }
    ],
    "firewallState": "string",
    "newTier": "string",
    "trustedIdProviders": [
      {
        "name": "string",
        "properties": {
          "idProvider": "string"
        }
      }
    ],
    "trustedIdProviderState": "string",
    "virtualNetworkRules": [
      {
        "name": "string",
        "properties": {
          "subnetId": "string"
        }
      }
    ]
  }
}

但是,ADLS 的 JSON 视图不是所需的格式,因此无法将 Azure ADLS JSON 视图用作部署脚本的一部分。按照上面的格式修改JSON,保存为JSON文件,上传到PowerShell,如下图:

enter image description here

执行以下命令部署ADLS帐户:

az deployment group create --resource-group "<resourceGroupName>" --template-file <fileName>.json

这将部署 ADLS 帐户,如下所示:

enter image description here


0
投票

不,这不是正确的 JSON。大多数资源在 Azure 门户的“自动化”部分左侧菜单中都有一个“导出模板”选项(请参阅文档)。这允许您生成可在部署管道中使用或通过运行

az deployment
来使用的 ARM 模板,例如:

© www.soinside.com 2019 - 2024. All rights reserved.