我们正在尝试使用ARM来申请并将相当复杂的设置部署到Azure中。 以下是基本组成部分:
我的大部分都在工作。我似乎无法弄清楚如何做的两个主要部分:
以下是针对一个应用的网站部署模板的代码段:
{
"name": "[variables('UxWebAppName')]",
"type": "Microsoft.Web/sites",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
],
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
"displayName": "UxWebApp"
},
"properties": {
"name": "[variables('UxWebAppName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"name": "web",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', variables('UxWebAppName'))]"
],
"properties": {
"phpVersion": "5.5",
"netFrameworkVersion": "v4.6",
"use32BitWorkerProcess": false, /* 64-bit platform */
"webSocketsEnabled": true,
"alwaysOn": true,
"remoteDebuggingEnabled": false,
"virtualApplications": [
{
"virtualPath": "/",
"physicalPath": "site\\wwwroot"
},
{
"virtualPath": "/api",
"physicalPath": "site\\wwwroot\\api"
}
],
"defaultDocuments": [
"index.html",
"hostingstart.html"
]
}
},
{
"name": "MSDeploy",
"type": "extensions",
"location": "[resourceGroup().location]",
"apiVersion": "2015-08-01",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('UxWebAppName'))]"
],
"tags": {
"displayName": "UxDeploy"
},
"properties": {
"packageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('UxDeployPackageFolder'), '/', parameters('UxDeployPackageFileName'), parameters('_artifactsLocationSasToken'))]",
"dbType": "None",
"connectionString": "",
"setParameters": {
"IIS Web Application Name": "[variables('UxWebAppName')]"
}
}
}
我试图添加第二个MSDeploy扩展元素,但是在部署期间导致错误,说明存在重复的节点。
这是sql server部分的代码片段:
{
"name": "[variables('sqlserverName')]",
"type": "Microsoft.Sql/servers",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "SqlServer"
},
"apiVersion": "2014-04-01-preview",
"properties": {
"administratorLogin": "[parameters('administratorLogin')]",
"administratorLoginPassword": "[parameters('administratorLoginPassword')]"
},
"resources": [
{
"name": "[parameters('coreDatabaseName')]",
"type": "databases",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "CoreDatabase"
},
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlserverName'))]"
],
"properties": {
"edition": "[parameters('edition')]",
"collation": "[parameters('collation')]",
"maxSizeBytes": "[parameters('maxSizeBytes')]",
"requestedServiceObjectiveName": "[parameters('requestedServiceObjectiveName')]"
},
"resources": [
{
"name": "Import",
"type": "extensions",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[parameters('coreDatabaseName')]"
],
"tags": {
"displayName": "CoreDb"
},
"properties": {
"storageKeyType": "[parameters('CoreDbStorageKeyType')]",
"storageKey": "[parameters('primaryKey')]",
"storageUri": "[concat(parameters('_artifactsLocation'), '/', parameters('CoreDbStoragePackageFolder'), '/', parameters('CoreDbStoragePackageFileName'))]",
"administratorLogin": "[parameters('administratorLogin')]",
"administratorLoginPassword": "[parameters('administratorLoginPassword')]",
"operationMode": "Import"
}
}
]
},
{
"type": "firewallrules",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', variables('sqlserverName'))]"
],
"location": "[resourceGroup().location]",
"name": "AllowAllWindowsAzureIps",
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
}
}
]
}
这似乎只适用于bacpac文件,但不适用于dacpac。我无法在网络上找到任何有用的信息。我发现可能有几个条目正在谈论在网络应用程序项目中包含dacpac,但这种方法对我来说似乎很奇怪。我尝试将operationMode设置为Publish(假设它在引擎盖下使用sqlpackage),但它表示它不受支持。
有没有人使用ARM有这两种部署类型的经验?或者我只是第一批尝试这样做的豚鼠之一?
我想我可以使用powershell / msbuild deploy(我可以在其中指定虚拟目录等)单独执行dacpac和web应用程序的部署,但据我所知,这种类型会破坏ARM的目的吗? / p>
感谢任何有用的提示!
编辑我的部署在没有ARM的情况下工作,而申请部分使用MSBuild,如下所示: 对于使用publishprofile的web应用程序,很容易
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" ../xx/SomeApp.csproj /p:DeployOnBuild=true /p:PublishProfile=SomeApp.pubxml /p:VisualStudioVersion=12.0 /p:Password=******
对于像这样的sql部署:
"C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\sqlpackage.exe" /Action:Publish /SourceFile:"U:\bin\Database\Database.dacpac" /TargetConnectionString:"Server=some.database.windows.net,1433;Database=SomeDatabase;User ID=someUser;Password=*******;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" /p:GenerateSmartDefaults=True /p:RegisterDataTierApplication=True /p:BlockWhenDriftDetected=False /p:BlockOnPossibleDataLoss=False
问题纯粹是关于ARM模板部署。我的意思是,我可以拆分申请(使用ARM)和部署(使用msdeploy或Powershell DSC),但我认为我只是做得不对,因为部署的某些部分(例如Web包)正在运行。 真的只有一半的东西得到支持,但有一半不是(还)吗?
答案 0 :(得分:0)
让我试着回答我们的一个问题:
我试图找到一种方法将两个单独的Web项目部署到 azure web app,但是分为两个不同的虚拟应用程序。我发现了一个 在一个WebDeploy上配置虚拟应用程序路径的方法,但我不能 将第二个项目添加到同一个WebSite节点中。
Publish Multiple Projects to Different Locations on Azure Website
答案 1 :(得分:0)