你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

SAP 自动化框架中的工作负载区域部署

SAP 应用程序通常具有多个部署层。 例如,可能具有开发层、质量保证层和生产层。 SAP 部署自动化框架将这些层称为工作负载区域

可以在多个 Azure 区域中使用工作负载区域。 然后,每个工作负载区域都有其自己的 Azure 虚拟网络实例。

SAP 工作负载区域提供以下服务:

  • 一个虚拟网络,包括子网和网络安全组
  • 一个 Azure Key Vault 实例,用于系统凭据
  • 一个用于启动诊断的 Azure 存储帐户
  • 一个用于云见证的存储帐户
  • 一个 Azure NetApp 文件帐户和容量池(可选)
  • Azure 文件存储 NFS 共享(可选)
  • Azure Monitor for SAP(可选)

Diagram that shows an SAP workload zone.

工作负载区域通常部署在中心辐射型体系结构的分支中。 它们可以位于其自己的订阅中。

控制平面中或可配置的源中支持专用 DNS。

核心配置

以下示例参数文件只显示必需的参数。

# The environment value is a mandatory field, it is used for partitioning the environments, for example (PROD and NP)
environment="DEV"

# The location value is a mandatory field, it is used to control where the resources are deployed
location="westeurope"

# The network logical name is mandatory - it is used in the naming convention and should map to the workload virtual network logical name
network_name="SAP01"

# network_address_space is a mandatory parameter when an existing virtual network is not used
network_address_space="10.110.0.0/16"

# admin_subnet_address_prefix is a mandatory parameter if the subnets are not defined in the workload or if existing subnets are not used
admin_subnet_address_prefix="10.110.0.0/19"

# db_subnet_address_prefix is a mandatory parameter if the subnets are not defined in the workload or if existing subnets are not used
db_subnet_address_prefix="10.110.96.0/19"

# app_subnet_address_prefix is a mandatory parameter if the subnets are not defined in the workload or if existing subnets are not used
app_subnet_address_prefix="10.110.32.0/19"

# The automation_username defines the user account used by the automation
automation_username="azureadm"

准备工作负载区域部署凭据

SAP 部署自动化框架在执行部署时使用服务主体。 若要为工作负载区域部署创建服务主体,请使用有权创建服务主体的帐户:

az ad sp create-for-rbac --role="Contributor" --scopes="/subscriptions/<subscriptionID>" --name="<environment>-Deployment-Account"

重要

服务主体的名称必须唯一。

记下命令的输出值:

  • appId
  • password
  • tenant

向服务主体分配正确的权限。

az role assignment create --assignee <appId> \
    --scope /subscriptions/<subscriptionID> \
    --role "User Access Administrator"

部署 SAP 工作负载区域

示例工作负载区域配置文件 DEV-WEEU-SAP01-INFRASTRUCTURE.tfvars 位于 ~/Azure_SAP_Automated_Deployment/samples/Terraform/WORKSPACES/LANDSCAPE/DEV-WEEU-SAP01-INFRASTRUCTURE 文件夹中。

运行以下命令来部署 SAP 工作负载区域。

通过部署程序执行此任务。

可以复制示例配置文件以开始测试部署自动化框架。

cd ~/Azure_SAP_Automated_Deployment

cp -R sap-automation/samples/WORKSPACES config


export  ARM_SUBSCRIPTION_ID="<subscriptionId>"
export        ARM_CLIENT_ID="<appId>"
export    ARM_CLIENT_SECRET="<password>"
export        ARM_TENANT_ID="<tenantId>"
export             env_code="DEV"
export          region_code="<region_code>"
export            vnet_code="SAP02"
export deployer_environment="MGMT"


export DEPLOYMENT_REPO_PATH="${HOME}/Azure_SAP_Automated_Deployment/sap-automation"
export CONFIG_REPO_PATH="${HOME}/Azure_SAP_Automated_Deployment/config/WORKSPACES"
export SAP_AUTOMATION_REPO_PATH="${HOME}/Azure_SAP_Automated_Deployment/sap-automation"

az login --service-principal -u "${ARM_CLIENT_ID}" -p="${ARM_CLIENT_SECRET}" --tenant "${ARM_TENANT_ID}"


cd "${CONFIG_REPO_PATH}/LANDSCAPE/${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE"
parameterFile="${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE.tfvars"

$SAP_AUTOMATION_REPO_PATH/deploy/scripts/install_workloadzone.sh   \
    --parameterfile "${parameterFile}"                             \
    --deployer_environment "${deployer_environment}"               \ 
    --subscription "${ARM_SUBSCRIPTION_ID}"                        \
    --spn_id "${ARM_CLIENT_ID}"                                    \
    --spn_secret "${ARM_CLIENT_SECRET}"                            \
    --tenant_id "${ARM_TENANT_ID}"
    

提示

如果脚本无法运行,有时可以通过删除 ~/.sap_deployment_automation/~/.terraform.d/ 目录来帮助清除本地缓存文件,然后再次运行脚本。

下一步