From 67925fe17cd8e344ccda6c1c4aa9b1a25a1d0e35 Mon Sep 17 00:00:00 2001 From: Robert Johnson Date: Thu, 7 May 2020 16:43:58 -0400 Subject: [PATCH] Switch CI build to use yaml and docker (#978) Add new build scripts for CI build that use docker --- README.md | 2 +- build/.vsts-ci.yml | 24 --- build/.vsts-package-ci.yml | 2 +- build/build-variables.yml | 17 ++ build/ci-deploy.yml | 148 ++++++++++++++++ build/ci-pipeline.yml | 160 ++++++++++++++++++ build/ci-variables.yml | 7 + build/{ => jobs}/build.yml | 0 build/{ => jobs}/docker-build-all.yml | 0 build/{ => jobs}/docker-build-push.yml | 0 build/{ => jobs}/package-web.yml | 0 build/{ => jobs}/package.yml | 7 +- build/jobs/redeploy-webapp.yml | 24 +++ build/pr-pipeline.yml | 8 +- build/pr-variables.yml | 20 +-- build/test-version.yml | 0 .../default-azuredeploy-docker-sql.json | 4 +- .../templates/default-azuredeploy-docker.json | 4 +- .../templates/default-azuredeploy-sql.json | 2 +- samples/templates/default-azuredeploy.json | 2 +- 20 files changed, 370 insertions(+), 61 deletions(-) delete mode 100644 build/.vsts-ci.yml create mode 100644 build/ci-deploy.yml create mode 100644 build/ci-pipeline.yml create mode 100644 build/ci-variables.yml rename build/{ => jobs}/build.yml (100%) rename build/{ => jobs}/docker-build-all.yml (100%) rename build/{ => jobs}/docker-build-push.yml (100%) rename build/{ => jobs}/package-web.yml (100%) rename build/{ => jobs}/package.yml (90%) create mode 100644 build/jobs/redeploy-webapp.yml delete mode 100644 build/test-version.yml diff --git a/README.md b/README.md index bf7add7da..95588414b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A .NET Core implementation of the FHIR standard. -[![CI Status](https://microsofthealthoss.vsrm.visualstudio.com/_apis/public/Release/badge/7621b231-1a7d-4364-935b-2f72b911c43d/1/1)](https://microsofthealthoss.visualstudio.com/FhirServer/_releases2) +[![Build Status](https://microsofthealthoss.visualstudio.com/FhirServer/_apis/build/status/CI%20Build%20%26%20Deploy?branchName=master)](https://microsofthealthoss.visualstudio.com/FhirServer/_build/latest?definitionId=27&branchName=master) FHIR Server for Azure is an open-source implementation of the emerging [HL7 Fast Healthcare Interoperability Resources (FHIR) specification](https://www.hl7.org/fhir/) designed for the Microsoft cloud. The FHIR specification defines how clinical health data can be made interoperable across systems, and the FHIR Server for Azure helps facilitate that interoperability in the cloud. The goal of this Microsoft Healthcare project is to enable developers to rapidly deploy a FHIR service. diff --git a/build/.vsts-ci.yml b/build/.vsts-ci.yml deleted file mode 100644 index fcf2cd09a..000000000 --- a/build/.vsts-ci.yml +++ /dev/null @@ -1,24 +0,0 @@ -# DESCRIPTION: -# Builds, tests and packages the solution for the CI build configuration. - -name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:-r) -variables: -- template: build-variables.yml -jobs: -- job: Windows - pool: - vmImage: 'windows-2019' - steps: - - template: build.yml - -- job: Linux - pool: - vmImage: 'ubuntu-latest' - steps: - - template: build.yml - parameters: - packageArtifacts: false - -- template: docker-build-all.yml - parameters: - tag: $(build.sourceBranchName) diff --git a/build/.vsts-package-ci.yml b/build/.vsts-package-ci.yml index 47d0d4c80..c7b9e0443 100644 --- a/build/.vsts-package-ci.yml +++ b/build/.vsts-package-ci.yml @@ -28,4 +28,4 @@ jobs: & build/Update-Packages.ps1 -PackageName "Hl7.Fhir.Stu3" -PackageVersion $packageStu3Version | Out-Null & build/Update-Packages.ps1 -PackageName "Hl7.Fhir.R4" -PackageVersion $packageR4Version | Out-Null workingDirectory: $(Build.SourcesDirectory) - - template: build.yml + - template: ./jobs/build.yml diff --git a/build/build-variables.yml b/build/build-variables.yml index cf4fcc539..2d14d1152 100644 --- a/build/build-variables.yml +++ b/build/build-variables.yml @@ -6,3 +6,20 @@ variables: azureSubscriptionEndpoint: 'docker-build' azureContainerRegistry: 'healthplatformregistry.azurecr.io' composeLocation: 'build/docker/docker-compose.yaml' + DeploymentEnvironmentNameSql: '$(DeploymentEnvironmentName)-sql' + DeploymentEnvironmentNameR4: '$(DeploymentEnvironmentName)-r4' + DeploymentEnvironmentNameR4Sql: '$(DeploymentEnvironmentNameR4)-sql' + DeploymentEnvironmentNameR5: '$(DeploymentEnvironmentName)-r5' + DeploymentEnvironmentNameR5Sql: '$(DeploymentEnvironmentNameR5)-sql' + TestEnvironmentUrl: 'https://$(DeploymentEnvironmentName).azurewebsites.net' + # These variables are not used in the deployment scripts, but are used in the E2E tests files. + TestEnvironmentUrl_Sql: 'https://$(DeploymentEnvironmentName)-sql.azurewebsites.net' + TestEnvironmentUrl_R4: 'https://$(DeploymentEnvironmentName)-r4.azurewebsites.net' + TestEnvironmentUrl_R4_Sql: 'https://$(DeploymentEnvironmentName)-r4-sql.azurewebsites.net' + TestEnvironmentUrl_R5: 'https://$(DeploymentEnvironmentName)-r5.azurewebsites.net' + TestEnvironmentUrl_R5_Sql: 'https://$(DeploymentEnvironmentName)-r5-sql.azurewebsites.net' + #----------------------------------------------------------------------------------------- + CrucibleEnvironmentUrl: 'https://crucible.mshapis.com/' + TestClientUrl: 'https://$(DeploymentEnvironmentName)-client/' + ConnectedServiceName: 'Microsoft Health Open Source Subscription' + WindowsVmImage: 'windows-latest' diff --git a/build/ci-deploy.yml b/build/ci-deploy.yml new file mode 100644 index 000000000..135163c77 --- /dev/null +++ b/build/ci-deploy.yml @@ -0,0 +1,148 @@ +# DESCRIPTION: +# Deploys the CI environment in case the persistant resources are deleted or broken. + +name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:-r) +trigger: none + +variables: +- template: ci-variables.yml +- template: build-variables.yml + +stages: +- stage: DockerBuild + displayName: 'Build images' + dependsOn: [] + jobs: + - template: ./jobs/docker-build-all.yml + parameters: + tag: $(ImageTag) + +- stage: provisionEnvironment + displayName: Provision Environment + dependsOn: [] + jobs: + - template: ./jobs/cleanup.yml + - job: provision + dependsOn: DeleteResourceGroup + steps: + - task: AzurePowerShell@4 + displayName: Provision Resource Group + inputs: + azureSubscription: $(ConnectedServiceName) + azurePowerShellVersion: latestVersion + ScriptType: inlineScript + Inline: | + New-AzResourceGroup -Name "$(DeploymentEnvironmentName)" -Location "$(ResourceGroupRegion)" -Force + +- stage: aadTestEnvironment + displayName: Setup AAD Test Environment + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/add-aad-test-environment.yml + +- stage: deployStu3 + displayName: 'Deploy STU3 Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: Stu3 + webAppName: $(DeploymentEnvironmentName) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) + +- stage: deployStu3Sql + displayName: 'Deploy STU3 SQL Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: Stu3 + sql: true + webAppName: $(DeploymentEnvironmentNameSql) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) + +- stage: deployR4 + displayName: 'Deploy R4 Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: R4 + webAppName: $(DeploymentEnvironmentNameR4) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) + +- stage: deployR4Sql + displayName: 'Deploy R4 SQL Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: R4 + sql: true + webAppName: $(DeploymentEnvironmentNameR4Sql) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) + +- stage: deployR5 + displayName: 'Deploy R5 Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: R5 + webAppName: $(DeploymentEnvironmentNameR5) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) + +- stage: deployR5Sql + displayName: 'Deploy R5 SQL Site' + dependsOn: + - provisionEnvironment + - DockerBuild + jobs: + - template: ./jobs/provision-deploy.yml + parameters: + version: R5 + sql: true + webAppName: $(DeploymentEnvironmentNameR5Sql) + appServicePlanName: $(appServicePlanName) + appServicePlanResourceGroup: $(appServicePlanResourceGroup) + subscription: $(ConnectedServiceName) + resourceGroup: $(DeploymentEnvironmentName) + testEnvironmentUrl: $(TestEnvironmentUrl) + imageTag: $(ImageTag) diff --git a/build/ci-pipeline.yml b/build/ci-pipeline.yml new file mode 100644 index 000000000..354a3377d --- /dev/null +++ b/build/ci-pipeline.yml @@ -0,0 +1,160 @@ +# DESCRIPTION: +# Builds, tests, and packages the solution for all PR requests. + +name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:-r) +trigger: none + +variables: +- template: ci-variables.yml +- template: build-variables.yml + +stages: +- stage: BuildUnitTests + displayName: 'Build and run unit tests' + dependsOn: [] + jobs: + - job: Windows + pool: + vmImage: $(WindowsVmImage) + steps: + - template: ./jobs/build.yml + + - job: Linux + pool: + vmImage: 'ubuntu-latest' + steps: + - template: ./jobs/build.yml + parameters: + packageArtifacts: false + +- stage: DockerBuild + displayName: 'Build images' + dependsOn: [] + jobs: + - template: ./jobs/docker-build-all.yml + parameters: + tag: $(ImageTag) + +- stage: redeployStu3 + displayName: 'Redeploy STU3 Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: Stu3 + webAppName: $(DeploymentEnvironmentName) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: redeployStu3Sql + displayName: 'Redeploy STU3 SQL Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: Stu3 + webAppName: $(DeploymentEnvironmentNameSql) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: redeployR4 + displayName: 'Redeploy R4 Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: R4 + webAppName: $(DeploymentEnvironmentNameR4) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: redeployR4Sql + displayName: 'Redeploy R4 SQL Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: R4 + webAppName: $(DeploymentEnvironmentNameR4Sql) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: redeployR5 + displayName: 'Redeploy R5 Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: R5 + webAppName: $(DeploymentEnvironmentNameR5) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: redeployR5Sql + displayName: 'Redeploy R5 SQL Site' + dependsOn: + - DockerBuild + jobs: + - template: ./jobs/redeploy-webapp.yml + parameters: + version: R5 + webAppName: $(DeploymentEnvironmentNameR5Sql) + subscription: $(ConnectedServiceName) + imageTag: $(ImageTag) + +- stage: testStu3 + displayName: 'Run Stu3 Tests' + dependsOn: + - BuildUnitTests + - redeployStu3 + - redeployStu3Sql + jobs: + - template: ./jobs/run-tests.yml + parameters: + version: Stu3 + keyVaultName: $(DeploymentEnvironmentName) + +- stage: testR4 + displayName: 'Run R4 Tests' + dependsOn: + - BuildUnitTests + - redeployR4 + - redeployR4Sql + jobs: + - template: ./jobs/run-tests.yml + parameters: + version: R4 + keyVaultName: $(DeploymentEnvironmentNameR4) + +- stage: testR5 + displayName: 'Run R5 Tests' + dependsOn: + - BuildUnitTests + - redeployR5 + - redeployR5Sql + jobs: + - template: ./jobs/run-tests.yml + parameters: + version: R5 + keyVaultName: $(DeploymentEnvironmentNameR5) + +- stage: securityScan + displayName: Security Scan + dependsOn: [] + jobs: + - job: runScan + pool: + vmImage: $(WindowsVmImage) + steps: + - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@3 + displayName: 'Run MpCmdRun.exe' + inputs: + FileDirPath: '$(System.ArtifactsDirectory)' + EnableServices: true + SignatureFreshness: OneDay + TreatStaleSignatureAs: Warning diff --git a/build/ci-variables.yml b/build/ci-variables.yml new file mode 100644 index 000000000..41c96c42d --- /dev/null +++ b/build/ci-variables.yml @@ -0,0 +1,7 @@ +variables: + ResourceGroupRegion: 'southcentralus' + resourceGroupRoot: 'msh-fhir-ci' + appServicePlanName: '$(resourceGroupRoot)-linux' + DeploymentEnvironmentName: '$(resourceGroupRoot)' + TestEnvironmentName: 'OSS CI' + ImageTag: '$(build.BuildNumber)' diff --git a/build/build.yml b/build/jobs/build.yml similarity index 100% rename from build/build.yml rename to build/jobs/build.yml diff --git a/build/docker-build-all.yml b/build/jobs/docker-build-all.yml similarity index 100% rename from build/docker-build-all.yml rename to build/jobs/docker-build-all.yml diff --git a/build/docker-build-push.yml b/build/jobs/docker-build-push.yml similarity index 100% rename from build/docker-build-push.yml rename to build/jobs/docker-build-push.yml diff --git a/build/package-web.yml b/build/jobs/package-web.yml similarity index 100% rename from build/package-web.yml rename to build/jobs/package-web.yml diff --git a/build/package.yml b/build/jobs/package.yml similarity index 90% rename from build/package.yml rename to build/jobs/package.yml index 98eb4e1e5..980948157 100644 --- a/build/package.yml +++ b/build/jobs/package.yml @@ -1,7 +1,6 @@ steps: # Package web - # ------Can be removed once CI uses docker--------------- - template: package-web.yml parameters: csproj: '**/Microsoft.Health.Fhir.Stu3.Web.csproj' @@ -13,7 +12,7 @@ steps: - template: package-web.yml parameters: csproj: '**/Microsoft.Health.Fhir.R5.Web.csproj' - # ------------------------------------------------------- + - task: DotNetCoreCLI@2 displayName: 'dotnet publish Integration Tests' inputs: @@ -38,7 +37,6 @@ steps: nuget_version: 1.0.0-$(build.buildNumber) # Publish artifacts - # ------Can be removed once CI uses docker--------------- - task: PublishBuildArtifacts@1 displayName: 'publish web artifacts' inputs: @@ -80,7 +78,6 @@ steps: pathToPublish: './release/' artifactName: 'deploy' artifactType: 'container' - # ------------------------------------------------------- - task: PublishBuildArtifacts@1 displayName: 'publish nuget artifacts' @@ -95,5 +92,3 @@ steps: pathToPublish: '$(build.binariesdirectory)/IntegrationTests' artifactName: 'IntegrationTests' artifactType: 'container' - parallel: true - parallelCount: 8 diff --git a/build/jobs/redeploy-webapp.yml b/build/jobs/redeploy-webapp.yml new file mode 100644 index 000000000..b5946984d --- /dev/null +++ b/build/jobs/redeploy-webapp.yml @@ -0,0 +1,24 @@ +parameters: +- name: version + type: string +- name: webAppName + type: string +- name: subscription + type: string +- name: imageTag + type: string + +jobs: +- job: provisionEnvironment + pool: + vmImage: $(WindowsVmImage) + steps: + - task: AzureRmWebAppDeployment@4 + displayName: 'Azure App Service Deploy' + inputs: + azureSubscription: '${{ parameters.subscription }}' + appType: 'webAppContainer' + WebAppName: '${{ parameters.webAppName }}' + DockerNamespace: $(azureContainerRegistry) + DockerRepository: '${{ parameters.version }}_fhir-server' + DockerImageTag: ${{ parameters.imageTag }} \ No newline at end of file diff --git a/build/pr-pipeline.yml b/build/pr-pipeline.yml index 2510dbe0f..815d369fa 100644 --- a/build/pr-pipeline.yml +++ b/build/pr-pipeline.yml @@ -5,8 +5,8 @@ name: pr$(system.pullRequest.pullRequestNumber)-$(Date:yyyyMMdd)$(Rev:-r) trigger: none variables: -- template: build-variables.yml - template: pr-variables.yml +- template: build-variables.yml stages: - stage: BuildUnitTests @@ -17,13 +17,13 @@ stages: pool: vmImage: $(WindowsVmImage) steps: - - template: build.yml + - template: ./jobs/build.yml - job: Linux pool: vmImage: 'ubuntu-latest' steps: - - template: build.yml + - template: ./jobs/build.yml parameters: packageArtifacts: false @@ -31,7 +31,7 @@ stages: displayName: 'Build images' dependsOn: [] jobs: - - template: docker-build-all.yml + - template: ./jobs/docker-build-all.yml parameters: tag: $(ImageTag) diff --git a/build/pr-variables.yml b/build/pr-variables.yml index ab5c1bc46..5358b64e7 100644 --- a/build/pr-variables.yml +++ b/build/pr-variables.yml @@ -1,26 +1,8 @@ variables: - ConnectedServiceName: 'Microsoft Health Open Source Subscription' ResourceGroupRegion: 'southcentralus' resourceGroupRoot: 'msh-fhir-pr' - appServicePlanResourceGroup: '$(resourceGroupRoot)-$(prNumber)' appServicePlanName: '$(resourceGroupRoot)-$(prNumber)-asp' prNumber: $(system.pullRequest.pullRequestNumber) DeploymentEnvironmentName: '$(resourceGroupRoot)-$(prNumber)' - DeploymentEnvironmentNameSql: '$(DeploymentEnvironmentName)-sql' - DeploymentEnvironmentNameR4: '$(DeploymentEnvironmentName)-r4' - DeploymentEnvironmentNameR4Sql: '$(DeploymentEnvironmentNameR4)-sql' - DeploymentEnvironmentNameR5: '$(DeploymentEnvironmentName)-r5' - DeploymentEnvironmentNameR5Sql: '$(DeploymentEnvironmentNameR5)-sql' - CrucibleEnvironmentUrl: 'https://crucible.mshapis.com/' - TestEnvironmentUrl: 'https://$(DeploymentEnvironmentName).azurewebsites.net' - # These variables are not used in the deployment scripts, but are used in the E2E tests files. - TestEnvironmentUrl_Sql: 'https://$(DeploymentEnvironmentName)-sql.azurewebsites.net' - TestEnvironmentUrl_R4: 'https://$(DeploymentEnvironmentName)-r4.azurewebsites.net' - TestEnvironmentUrl_R4_Sql: 'https://$(DeploymentEnvironmentName)-r4-sql.azurewebsites.net' - TestEnvironmentUrl_R5: 'https://$(DeploymentEnvironmentName)-r5.azurewebsites.net' - TestEnvironmentUrl_R5_Sql: 'https://$(DeploymentEnvironmentName)-r5-sql.azurewebsites.net' - #----------------------------------------------------------------------------------------- - TestClientUrl: 'https://$(DeploymentEnvironmentName)-client/' TestEnvironmentName: 'OSS PR$(prNumber)' - WindowsVmImage: 'windows-latest' - ImageTag: 'pr$(prNumber)' + ImageTag: '$(build.BuildNumber)' diff --git a/build/test-version.yml b/build/test-version.yml deleted file mode 100644 index e69de29bb..000000000 diff --git a/samples/templates/default-azuredeploy-docker-sql.json b/samples/templates/default-azuredeploy-docker-sql.json index 63bead995..e0a795098 100644 --- a/samples/templates/default-azuredeploy-docker-sql.json +++ b/samples/templates/default-azuredeploy-docker-sql.json @@ -133,7 +133,7 @@ }, "imageTag": { "type": "string", - "defaultValue": "latest", + "defaultValue": "release", "metadata": { "description": "Tag of the docker image to deploy." } @@ -384,7 +384,7 @@ { "type": "Microsoft.Storage/storageAccounts/providers/roleAssignments", "apiVersion": "2018-09-01-preview", - "name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(uniqueString(variables('storageAccountName'), parameters('fhirVersion'), variables('serviceName'))))]", + "name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(variables('storageAccountName'), parameters('fhirVersion'), variables('serviceName')))]", "condition": "[parameters('enableExport')]", "dependsOn": [ "[variables('storageAccountName')]", diff --git a/samples/templates/default-azuredeploy-docker.json b/samples/templates/default-azuredeploy-docker.json index 123e90a62..898587d32 100644 --- a/samples/templates/default-azuredeploy-docker.json +++ b/samples/templates/default-azuredeploy-docker.json @@ -129,7 +129,7 @@ }, "imageTag": { "type": "string", - "defaultValue": "latest", + "defaultValue": "release", "metadata": { "description": "Tag of the docker image to deploy." } @@ -362,7 +362,7 @@ { "type": "Microsoft.Storage/storageAccounts/providers/roleAssignments", "apiVersion": "2018-09-01-preview", - "name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(uniqueString(variables('storageAccountName'), parameters('fhirVersion'), variables('serviceName'))))]", + "name": "[concat(variables('storageAccountName'), '/Microsoft.Authorization/', guid(variables('storageAccountName'), parameters('fhirVersion'), variables('serviceName')))]", "condition": "[parameters('enableExport')]", "dependsOn": [ "[variables('storageAccountName')]", diff --git a/samples/templates/default-azuredeploy-sql.json b/samples/templates/default-azuredeploy-sql.json index 0354daebf..ae2844709 100644 --- a/samples/templates/default-azuredeploy-sql.json +++ b/samples/templates/default-azuredeploy-sql.json @@ -171,7 +171,7 @@ }, "combinedFhirServerConfigProperties": "[union(variables('staticFhirServerConfigProperties'), parameters('additionalFhirServerConfigProperties'))]", "computedSqlServerReference": "[concat('Microsoft.Sql/servers/', variables('serviceName'))]", - "storageAccountName": "[concat(substring(replace(variables('serviceName'), '-', ''), 0, min(11, length(variables('serviceName')))), uniquestring(resourceGroup().id, variables('serviceName')))]" + "storageAccountName": "[concat(substring(replace(variables('serviceName'), '-', ''), 0, min(11, length(replace(variables('serviceName'), '-', '')))), uniquestring(resourceGroup().id, variables('serviceName')))]" }, "resources": [ { diff --git a/samples/templates/default-azuredeploy.json b/samples/templates/default-azuredeploy.json index 8f44772a5..dc30d231b 100644 --- a/samples/templates/default-azuredeploy.json +++ b/samples/templates/default-azuredeploy.json @@ -165,7 +165,7 @@ "FhirServer:Operations:Export:StorageAccountUri": "[if(parameters('enableExport'), concat('https://', variables('storageAccountName'), variables('blobStorageUri')), 'null')]" }, "combinedFhirServerConfigProperties": "[union(variables('staticFhirServerConfigProperties'), parameters('additionalFhirServerConfigProperties'))]", - "storageAccountName": "[concat(substring(replace(variables('serviceName'), '-', ''), 0, min(11, length(variables('serviceName')))), uniquestring(resourceGroup().id, variables('serviceName')))]" + "storageAccountName": "[concat(substring(replace(variables('serviceName'), '-', ''), 0, min(11, length(replace(variables('serviceName'), '-', '')))), uniquestring(resourceGroup().id, variables('serviceName')))]" }, "resources": [ {