你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
在 Azure Health Data Services 中部署 FHIR 服务 - 使用 ARM 模板
本文介绍如何使用 Azure 资源管理器 模板(ARM 模板)在 Azure Health Data Services(因此称为 FHIR 服务)中部署 FHIR 服务。 我们使用 PowerShell 或使用 CLI 提供两个选项。
ARM 模板是一个 JSON 文件,用于定义项目的基础结构和配置。 模板使用声明性语法。 在声明性语法中,你可以在不编写创建部署的编程命令序列的情况下,描述预期部署。
先决条件
- 具有活动订阅的 Azure 帐户。 免费创建一个。
- 若要在本地运行代码,请安装:
查看 ARM 模板
本文中使用的模板来自 Azure 快速入门模板。
该模板定义了三个 Azure 资源:
- Microsoft.HealthcareApis/workspaces
- Microsoft.HealthcareApis/workspaces/fhirservices
- Microsoft.Storage/storageAccounts
注意
本地 RBAC 已弃用。 ARM 模板中与本地 RBAC 关联的访问策略配置已弃用。 使用本地 RBAC 的现有客户需要在 2024 年 11 月前迁移到 Azure RBAC。 有关问题,请 与我们联系。
可以通过删除工作区资源、存储资源和dependsOn
“Microsoft.HealthcareApis/workspaces/fhirservices”资源中的属性来部署 FHIR 服务资源。
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"authorityurl": {
"type": "string",
"defaultValue": "https://login.microsoftonline.com"
},
"tagName": {
"type": "string",
"defaultValue": "My Deployment"
},
"region": {
"type": "string",
"allowedValues": [
"australiaeast",
"canadacentral",
"eastus",
"eastus2",
"germanywestcentral",
"japaneast",
"northcentralus",
"northeurope",
"southafricanorth",
"southcentralus",
"southeastasia",
"switzerlandnorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westus2"
]
},
"workspaceName": {
"type": "string"
},
"fhirServiceName": {
"type": "string"
},
"tenantid": {
"type": "string"
},
"storageAccountName": {
"type": "string"
},
"storageAccountConfirm": {
"type": "bool",
"defaultValue": true
},
"AccessPolicies": {
"type": "array",
"defaultValue": []
},
"smartProxyEnabled": {
"type": "bool",
"defaultValue": false
}
},
"variables": {
"authority": "[Concat(parameters('authorityurl'), '/', parameters('tenantid'))]",
"createManagedIdentity": true,
"managedIdentityType": {
"type": "SystemAssigned"
},
"storageBlobDataContributerRoleId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')]"
},
"resources": [
{
"type": "Microsoft.HealthcareApis/workspaces",
"name": "[parameters('workspaceName')]",
"apiVersion": "2023-11-01",
"location": "[parameters('region')]",
"properties": {}
},
{
"type": "Microsoft.HealthcareApis/workspaces/fhirservices",
"kind": "fhir-R4",
"name": "[concat(parameters('workspaceName'), '/', parameters('fhirServiceName'))]",
"apiVersion": "2023-11-01",
"location": "[parameters('region')]",
"dependsOn": [
"[resourceId('Microsoft.HealthcareApis/workspaces', parameters('workspaceName'))]"
],
"tags": {
"environmentName": "[parameters('tagName')]"
},
"properties": {
"accessPolicies": "[parameters('AccessPolicies')]",
"authenticationConfiguration": {
"authority": "[variables('Authority')]",
"audience": "[concat('https//', parameters('workspaceName'), '-', parameters('fhirServiceName'), '.fhir.azurehealthcareapis.com')]",
"smartProxyEnabled": "[parameters('smartProxyEnabled')]"
},
"corsConfiguration": {
"allowCredentials": false,
"headers": ["*"],
"maxAge": 1440,
"methods": ["DELETE", "GET", "OPTIONS", "PATCH", "POST", "PUT"],
"origins": ["https://localhost:6001"]
},
"exportConfiguration": {
"storageAccountName": "[parameters('storageAccountName')]"
}
},
"identity": "[if(variables('createManagedIdentity'), variables('managedIdentityType'), json('null'))]"
},
{
"name": "[parameters('storageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"location": "[resourceGroup().location]",
"properties": {
"supportsHttpsTrafficOnly": "true"
},
"condition": "[parameters('storageAccountConfirm')]",
"dependsOn": [
"[parameters('fhirServiceName')]"
],
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"tags": {
"environmentName": "[parameters('tagName')]",
"test-account-rg": "true"
}
}
],
"outputs": {
}
}
部署 ARM 模板
可以使用两个选项部署 ARM 模板:PowerShell 或 CLI。
下面提供的示例代码使用子文件夹“src”的“templates”子文件夹中的模板。 可能需要更改位置路径以正确引用模板文件。
部署过程需要几分钟才能完成。 记下 FHIR 服务和资源组的名称,稍后将用到该名称。
部署模板:使用 PowerShell
在本地 PowerShell、Visual Studio Code 或 Azure Cloud Shell 中运行代码以部署 FHIR 服务。
如果尚未登录到 Azure,请使用“连接-AzAccount”登录。 登录后,使用“Get-AzContext”验证要使用的订阅和租户。 如果需要,可以更改订阅和租户。
可以通过跳过步骤或使用现有资源组,或者注释掉以“New-AzResourceGroup”开头的行。
### variables
$resourcegroupname="your resource group"
$location="South Central US"
$workspacename="your workspace name"
$fhirservicename="your fhir service name"
$tenantid="xxx"
$subscriptionid="xxx"
$storageaccountname="storage account name"
$storageaccountconfirm=1
### login to azure
Connect-AzAccount
#Connect-AzAccount SubscriptionId $subscriptionid
Set-AzContext -Subscription $subscriptionid
Connect-AzAccount -Tenant $tenantid -SubscriptionId $subscriptionid
#Get-AzContext
### create resource group
New-AzResourceGroup -Name $resourcegroupname -Location $location
### deploy the resource
New-AzResourceGroupDeployment -ResourceGroupName $resourcegroupname -TemplateFile "src/templates/fhirtemplate.json" -region $location -workspaceName $workspacename -fhirServiceName $fhirservicename -tenantid $tenantid -storageAccountName $storageaccountname -storageAccountConfirm $storageaccountconfirm
查看已部署的资源
可以通过打开浏览器并导航到 https://<yourfhir servic>.azurehealthcareapis.com/metadata
来验证 FHIR 服务是否已启动并运行。 如果功能语句自动显示或下载,则部署成功。
清理资源
不再需要资源时,请运行以下代码以删除资源组。
$resourceGroupName = “your resource group name”
Remove-AzResourceGroup -Name $resourceGroupName
后续步骤
在本快速入门指南中,你已使用 ARM 模板在 Azure Health Data Services 中部署了 FHIR 服务。 有关 FHIR 服务支持的功能的详细信息,请参阅。
FHIR® 是 HL7 的注册商标,经 HL7 许可使用。