《Windows Azure Platform 系列文章目录》
之前介绍的ARM Template,都是使用文本编辑器来编辑JSON文件的。
文本讲介绍如何使用Visual Studio,编辑JSON Template。
本文使用Visual Studio 2015 with Update 3进行编辑,安装了Azure SDK 2.9。
如果读者使用的是Visual Studio 2013和Azure SDK 2.9,大部门的界面是和笔者的截图类似。笔者强烈建议安装最新的Visual Studio和Azure SDK。
前提:
1.安装Visual Studio 2015 with Update 3
2.安装Azure SDK 2.9
1.运行Visual Studio 2015 with Update 3
2.创建一个Azure Resource Group项目。如下图:
3.模板选择Blank Template
4.项目创建完毕后,不包含任何项目,我们选择Templates,双击 azuredeploy.json
5.显示如下图的JSON Outline,我们可以添加新的资源,点击resources,邮件,Add New Resource。如下图:
6.在弹出的界面中,输入Storage Account,然后色织storage account name (必须为小写英文),如下图:
7.修改Visual Studio项目中的azuredeploy.json文件,内容如下:
{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "leinewstorageType": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Premium_LRS" ] }, "storageAccounts_leistorageaccount_name": { "defaultValue": "leistorageaccount", "type": "String" } }, "variables": { }, "resources": [ { "name": "[parameters('storageAccounts_leistorageaccount_name')]", "type": "Microsoft.Storage/storageAccounts", "location": "[resourceGroup().location]", "apiVersion": "2015-06-15", "dependsOn": [], "tags": { "displayName": "leinewstorage" }, "properties": { "accountType": "[parameters('leinewstorageType')]" } } ], "outputs": { } }
8.修改azuredeploy.parameters.json文件,内容如下:
{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "storageAccounts_leistorageaccount_name": { "value": "leinewstorageaccount" } } }
最后通过Azure PowerShell进行发布,命令如下:
# sign in Write-Host "Logging in..."; Add-AzureRmAccount -EnvironmentName AzureChinaCloud; # select subscription Write-Host "Selecting subscription '$subscriptionId'"; Select-AzureRmSubscription -SubscriptionID $subscriptionId; #创建Resource Group New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation #部署Template New-AzureRmResourceGroupDeployment -ResourceGroupName "[ResourceGroupName]" -TemplateFile "[FilePath]" -TemplateParameterFile ["ParameterFilePath"];
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
2013-10-31 [SDK2.2]Windows Azure Storage (15) 使用WCF服务,将本地图片上传至Azure Storage (上) 服务器端代码