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

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

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

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

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

显示 SAP 工作负荷区域的示意图。

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

专用 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"

重要

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

记录命令中的输出值:

  • 应用程序ID
  • 密码
  • 租户

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

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/目录有助于清除本地缓存文件。

后续步骤