Azure存储和Blob使用Powershell帮助 [英] Azure Storage and Blob using Powershell help
问题描述
我使用webui创建了一个ARM模板,但我想使用PowerShell脚本将其作为PowerShell运行:
I have created a a ARM template using the webui however i would like to run it as a powershell using powershell scripts :
我的模板的基本版本修改如下:
A base version of my template is modified something like this :
{
  " $ schema":" http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" ;,
  "contentVersion":" 1.0.0.0",$
  "参数":{
      "location":{
          "type":" string"
      },b $ b       " storageAccountName":{
          "type":" string"
      },b $ b       "accountType":{
          "type":" string"
      },b $ b       "善意":{
          "type":" string"
      },b $ b       "accessTier":{
          "type":" string"
      },b $ b       "supportsHttpsTrafficOnly":{
          "type":" bool"
      }¥b $ b   },b $ b   "变量":{},
  "资源":[
      {
" name":" [parameters('storageAccountName')]" ,
          " type" ;:\"Microsoft.Storage/storageAccounts" ;,
          "apiVersion":" 2018-07-01",
" location":" [parameters('location) ')]",
          "properties":{
              " accessTier":" [parameters('accessTier')]",
              " supportsHttpsTrafficOnly":" [parameters('supportsHttpsTrafficOnly')]"
          },b $ b           "dependsOn":[],
          "sku":{
              " name":" [parameters('accountType')]"
          },b $ b           "kind":"[parameters('kind')]"
      }¥b $ b   ],
  "输出":{}
}
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string"
},
"storageAccountName": {
"type": "string"
},
"accountType": {
"type": "string"
},
"kind": {
"type": "string"
},
"accessTier": {
"type": "string"
},
"supportsHttpsTrafficOnly": {
"type": "bool"
}
},
"variables": {},
"resources": [
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-07-01",
"location": "[parameters('location')]",
"properties": {
"accessTier": "[parameters('accessTier')]",
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]"
},
"dependsOn": [],
"sku": {
"name": "[parameters('accountType')]"
},
"kind": "[parameters('kind')]"
}
],
"outputs": {}
}
------------ -
--------------
参数文件如下所示:
Parameters file would be something like below :
---------------- -------------------------------------------
-----------------------------------------------------------
" parameters" ;: {
$
" location" ;:{
          "value":" westeurope"
      },b $ b       " storageAccountName":{
          "value":" abcdata01121"
      },b $ b       "accountType":{
          "value":" Standard_ZRS"
      },b $ b       "善意":{
          "value":" StorageV2"
      },b $ b       "accessTier":{
          "value":"Hot"&b
      },b $ b       "supportsHttpsTrafficOnly":{
          "value":true
      }
"parameters": {
"location": {
"value": "westeurope"
},
"storageAccountName": {
"value": "abcdata01121"
},
"accountType": {
"value": "Standard_ZRS"
},
"kind": {
"value": "StorageV2"
},
"accessTier": {
"value": "Hot"
},
"supportsHttpsTrafficOnly": {
"value": true
}
----- --------------------------------
-------------------------------------
deploy.ps1文件 如下所示
deploy.ps1 file as below
$ subscriptionId =<订阅ID值>,
$
#Parameter(强制= $ True)]
[string]
$ resourceGroupName =" abcd ..",
[string]
$ resourceGroupLocation = " westeurope",
$subscriptionId =< subscription id value>,
#Parameter(Mandatory=$True)]
[string]
$resourceGroupName = "abcd..",
[string]
$resourceGroupLocation = "westeurope",
i'我无法传递订阅参数,而是在上面的deploy.ps1脚本中传递它们, 我可以在任何方式硬编码订阅ID和资源组详细信息参数/模板本身
?
i'm unable to pass in subscription parameters and instead would be passing them in deploy.ps1 script as above , Any way i can hard code the subscription id and resource group details in the parameters /template itself ?
还想为存储帐户提供一些名称: storageAccount_abcd_Name 并且存储帐户名应该增加,例如storageAccount_abcd0001,StorageAccount_abcd0002
等等?
Also would like to give some name for storage account something like : storageAccount_abcd_Name and the storage accountname should be incrementing like storageAccount_abcd0001 , StorageAccount_abcd0002 and so on ?
推荐答案
你好Viswanath,
Hello Viswanath,
你能详细说明更多信息来帮助改善这个问题吗?
Could you elaborate with more information to help better on this?
是否要使用Azure ARM模板创建存储帐户?
Do you want to create a storage account using Azure ARM template?
这篇关于Azure存储和Blob使用Powershell帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!