Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Azure存储帐户中创建表_Azure_Azure Resource Manager_Arm Template - Fatal编程技术网

在Azure存储帐户中创建表

在Azure存储帐户中创建表,azure,azure-resource-manager,arm-template,Azure,Azure Resource Manager,Arm Template,有没有办法使用ARM模板在Azure存储帐户内创建表?我可以使用PowerShell实现这一点,但找不到使用JSON模板的方法,而且当我使用()浏览部署资源时,我看不到对存储帐户下创建的表的任何引用,知道为什么吗 谢谢, 塞亚姆 据我所知,没有。你可以看看细节 表服务通过RESTAPI公开帐户、表和实体,因此您无法在门户中看到它们。你可以查看更多信息 通过一些简单的步骤使用ARM模板创建Azure存储。请找到以下步骤来实现它 第1步:打开powershell并使用Connect-AzureRmA

有没有办法使用ARM模板在Azure存储帐户内创建表?我可以使用PowerShell实现这一点,但找不到使用JSON模板的方法,而且当我使用()浏览部署资源时,我看不到对存储帐户下创建的表的任何引用,知道为什么吗

谢谢, 塞亚姆

  • 据我所知,没有。你可以看看细节
  • 表服务通过RESTAPI公开帐户、表和实体,因此您无法在门户中看到它们。你可以查看更多信息

  • 通过一些简单的步骤使用ARM模板创建Azure存储。请找到以下步骤来实现它

    第1步:打开powershell并使用
    Connect-AzureRmAccount

    步骤2:添加订阅ID
    选择AzureRmSubscription-SubscriptionId

    步骤3:创建资源组
    New AzureRmResourceGroup-命名您的资源组-位置“美国中南部”

    步骤4:创建azuredeploy.json和azuredeploy.parameters.json

    azuredeploy.json

    {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "type": "string",
            "metadata": {
                "description": "The name of the Azure Storage account."
            }
        },
        "containerName": {
            "type": "string",
            "defaultValue": "logs",
            "metadata": {
                "description": "The name of the blob container."
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "The location in which the Azure Storage resources should be deployed."
            }
        }
    },
    "resources": [
        {
            "name": "[parameters('storageAccountName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2018-02-01",
            "location": "[parameters('location')]",
            "kind": "StorageV2",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "properties": {
                "accessTier": "Hot"
            },
            "resources": [
                {
                    "name": "[concat('default/', parameters('containerName'))]",
                    "type": "blobServices/containers",
                    "apiVersion": "2018-03-01-preview",
                    "dependsOn": [
                        "[parameters('storageAccountName')]"
                    ]
                }
            ]
        }
    ]
    }
    
    {
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "value": "yourstorage"
        }
    }
    }
    
    azuredeploy.parameters.json

    {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "type": "string",
            "metadata": {
                "description": "The name of the Azure Storage account."
            }
        },
        "containerName": {
            "type": "string",
            "defaultValue": "logs",
            "metadata": {
                "description": "The name of the blob container."
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "The location in which the Azure Storage resources should be deployed."
            }
        }
    },
    "resources": [
        {
            "name": "[parameters('storageAccountName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2018-02-01",
            "location": "[parameters('location')]",
            "kind": "StorageV2",
            "sku": {
                "name": "Standard_LRS",
                "tier": "Standard"
            },
            "properties": {
                "accessTier": "Hot"
            },
            "resources": [
                {
                    "name": "[concat('default/', parameters('containerName'))]",
                    "type": "blobServices/containers",
                    "apiVersion": "2018-03-01-preview",
                    "dependsOn": [
                        "[parameters('storageAccountName')]"
                    ]
                }
            ]
        }
    ]
    }
    
    {
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageAccountName": {
            "value": "yourstorage"
        }
    }
    }
    
    步骤5:运行以下命令

    New-AzureRmResourceGroupDeployment -Name myDeployment -ResourceGroupName yourResourceGroup -TemplateFile <location>\azuredeploy.json -TemplateParameterFile <location>\azuredeploy.parameters.json
    

    您可以像这样通过ARM使用
    tableServices/tables
    子资源在
    storageAccount
    资源上创建一个带有表的Azure存储帐户:

    {
      "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "storageAccountName": {
          "type": "string",
          "minLength": 3,
          "maxLength": 24
        },
        "storageAccountSku": {
          "type": "string",
          "defaultValue": "Standard_LRS",
          "allowedValues": [
            "Standard_LRS",
            "Standard_GRS",
            "Standard_RAGRS"
          ]
        },
        "tableName": {
          "type": "string",
          "minLength": 3,
          "maxLength": 63
        }
      },
      "resources": [
        {
          "type": "Microsoft.Storage/storageAccounts",
          "name": "[parameters('storageAccountName')]",
          "apiVersion": "2019-06-01",
          "location": "[resourceGroup().location]",
          "kind": "StorageV2",
          "sku": {
            "name": "[parameters('storageAccountSku')]"
          },
          "resources": [
            {
              "name": "[concat('default/', parameters('tableName'))]",
              "type": "tableServices/tables",
              "apiVersion": "2019-06-01",
              "dependsOn": [
                "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
              ]
            }
          ]
        }
      ]
    }
    

    该功能记录在。

    Steven的回复是正确的:#1-您不能在模板部署中对存储执行数据平面操作。(即不能创建队列、容器、表等)实际上您可以创建一个容器。我还没有找到创建存储表的方法。此示例用于创建容器而不是表