コントロール プレーンをデプロイする

SAP デプロイ自動化フレームワーク用のコントロール プレーン デプロイは、以下で構成されます。

  • デプロイ機能
  • SAP ライブラリ

Diagram that shows the control plane.

デプロイ資格情報を準備する

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> --role "User Access Administrator" --scope /subscriptions/<subscriptionID>

リソース グループのみを対象管理ユーザー アクセス 管理istrator ロールを指定する場合は、次のコマンドを使用します。


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

コントロール プレーンをデプロイする

コントロール プレーンのデプロイに必要なすべての成果物は、GitHub リポジトリにあります。

次のコマンドを使用して、リポジトリを複製し、コントロール プレーンのデプロイを準備します。

mkdir -p ~/Azure_SAP_Automated_Deployment; cd $_

git clone https://github.com/Azure/sap-automation.git sap-automation

git clone https://github.com/Azure/sap-automation-samples.git samples

サンプルのデプロイ機能構成ファイル MGMT-WEEU-DEP00-INFRASTRUCTURE.tfvars は、~/Azure_SAP_Automated_Deployment/samples/Terraform/WORKSPACES/DEPLOYER/MGMT-WEEU-DEP00-INFRASTRUCTURE フォルダーにあります。

サンプルの SAP ライブラリ構成ファイル MGMT-WEEU-SAP_LIBRARY.tfvars は、~/Azure_SAP_Automated_Deployment/samples/Terraform/WORKSPACES/LIBRARY/MGMT-WEEU-SAP_LIBRARY フォルダーにあります。

サンプル構成ファイルをコピーして、デプロイ自動化フレームワークのテストを開始することができます。

DEPLOYER 用の最低限の Terraform ファイルは次の例のようになります。

# The environment value is a mandatory field, it is used for partitioning the environments.
environment = "MGMT"
# The location/region value is a mandatory field, it is used to control where the resources are deployed
location = "westeurope"

# management_network_address_space is the address space for management virtual network
management_network_address_space = "10.10.20.0/25"
# management_subnet_address_prefix is the address prefix for the management subnet
management_subnet_address_prefix = "10.10.20.64/28"

# management_firewall_subnet_address_prefix is the address prefix for the firewall subnet
management_firewall_subnet_address_prefix = "10.10.20.0/26"
firewall_deployment = false

# management_bastion_subnet_address_prefix is the address prefix for the bastion subnet
management_bastion_subnet_address_prefix = "10.10.20.128/26"
bastion_deployment = true

# deployer_enable_public_ip controls if the deployer Virtual machines will have Public IPs
deployer_enable_public_ip = false

# deployer_count defines how many deployer VMs will be deployed
deployer_count = 1

# use_service_endpoint defines that the management subnets have service endpoints enabled
use_service_endpoint = true

# use_private_endpoint defines that the storage accounts and key vaults have private endpoints enabled
use_private_endpoint = false

# enable_firewall_for_keyvaults_and_storage defines that the storage accounts and key vaults have firewall enabled
enable_firewall_for_keyvaults_and_storage = false

# public_network_access_enabled controls if storage account and key vaults have public network access enabled
public_network_access_enabled = true

今後デプロイ時に編集するために、Terraform 変数ファイルの場所をメモしておいてください。

LIBRARY 用の最低限の Terraform ファイルは次の例のようになります。

# The environment value is a mandatory field, it is used for partitioning the environments, for example, PROD and NP.
environment = "MGMT"
# The location/region value is a mandatory field, it is used to control where the resources are deployed
location = "westeurope"

#Defines the DNS suffix for the resources
dns_label = "azure.contoso.net"

# use_private_endpoint defines that the storage accounts and key vaults have private endpoints enabled
use_private_endpoint = false

今後デプロイ時に編集するために、Terraform 変数ファイルの場所をメモしておいてください。

次のコマンドを実行して、デプロイ機能および SAP ライブラリを作成します。 コマンドにより、サービス プリンシパルの詳細がデプロイ キー コンテナーに追加されます。

サービス プリンシパルの環境変数を設定します。


export ARM_SUBSCRIPTION_ID="<subscriptionId>"
export       ARM_CLIENT_ID="<appId>"
export   ARM_CLIENT_SECRET="<password>"
export       ARM_TENANT_ID="<tenantId>"

次のコマンドを実行して、コントロール プレーンをデプロイします。


export            env_code="MGMT"
export         region_code="WEEU"
export           vnet_code="DEP00"

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

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

cd ~/Azure_SAP_Automated_Deployment/WORKSPACES


deployer_parameter_file="${CONFIG_REPO_PATH}/DEPLOYER/${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE/${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE.tfvars"
library_parameter_file="${CONFIG_REPO_PATH}/LIBRARY/${env_code}-${region_code}-SAP_LIBRARY/${env_code}-${region_code}-SAP_LIBRARY.tfvars"

${SAP_AUTOMATION_REPO_PATH}/deploy/scripts/deploy_controlplane.sh  \
    --deployer_parameter_file "${deployer_parameter_file}"         \
    --library_parameter_file "${library_parameter_file}"            \
    --subscription "${ARM_SUBSCRIPTION_ID}"                        \
    --spn_id "${ARM_CLIENT_ID}"                                    \
    --spn_secret "${ARM_CLIENT_SECRET}"                            \
    --tenant_id "${ARM_TENANT_ID}"

Azure Bastion を使用して仮想マシンを SDAF デプロイツールとして手動で構成する

デプロイ機能に接続するには:

  1. Azure portal にサインインします。

  2. デプロイ機能の仮想マシン (VM) を含むリソース・グループに移動します。

  3. Azure Bastion を使用して VM に接続します。

  4. 既定のユーザー名は azureadm です。

  5. [Azure Key Vault から SSH 秘密キー] を選択します。

  6. コントロール プレーンを含むサブスクリプションを選択します。

  7. デプロイ機能キー コンテナーを選択します。

  8. シークレットの一覧から、-sshkey で終わるシークレットを選択します。

  9. VM に接続します。

次のスクリプトを実行して、デプロイ機能を構成します。


mkdir -p ~/Azure_SAP_Automated_Deployment; cd $_

wget https://raw.githubusercontent.com/Azure/sap-automation/main/deploy/scripts/configure_deployer.sh -O configure_deployer.sh	
chmod +x ./configure_deployer.sh
./configure_deployer.sh

# Source the new variables

. /etc/profile.d/deploy_server.sh

スクリプトによって Terraform と Ansible がインストールされ、デプロイ機能が構成されます。

SDAF デプロイ機能として、仮想マシンを手動で構成する

Azure 仮想ネットワークに到達できるコンピューターからデプロイ機能の VM に接続します。

デプロイ機能に接続するには:

  1. Azure portal にサインインします。

  2. [キー コンテナー] を選択または検索します。

  3. [キー コンテナー] ページで、デプロイ機能キー コンテナーを見つけます。 名前は MGMT[REGION]DEP00user で始まります。 必要に応じて、[リソース グループ] または [場所] でフィルター処理します。

  4. 左側のペインの [設定] セクションで、[シークレット] を選択します。

  5. sshkey を含むシークレットを検索して選択します。 MGMT-[REGION]-DEP00-sshkey のようになります。

  6. シークレットのページで、現在のバージョンを選択します。 次に、シークレット値をコピーします。

  7. プレーン テキスト エディターを開きます。 シークレットの値をコピーします。

  8. SSH キーが保持されている場所にファイルを保存します。 たとえば C:\Users\<your-username>\.ssh です。

  9. ファイルを保存します。 [保存の種類] を入力するように求められたら、SSH がオプションでない場合は [すべてのファイル] を選択します。 たとえば、 deployer.sshを使用します。

  10. Visual Studio Code など、任意の SSH クライアントを介してデプロイ機能 VM に接続します。 デプロイ機能のプライベート IP アドレスと、ダウンロードした SSH キーを使用します。 Visual Studio Code を使用してデプロイ機能に接続する方法については、Visual Studio Code を使用したデプロイ機能への接続に関するページを参照してください。 PuTTY を使用している場合は、PuTTYGen を使用して最初に SSH キー ファイルを変換します。

Note

既定のユーザー名は azureadm です。

次のスクリプトを使用してデプロイ機能を構成します。

mkdir -p ~/Azure_SAP_Automated_Deployment; cd $_

wget https://raw.githubusercontent.com/Azure/sap-automation/main/deploy/scripts/configure_deployer.sh -O configure_deployer.sh	
chmod +x ./configure_deployer.sh
./configure_deployer.sh

# Source the new variables

. /etc/profile.d/deploy_server.sh

スクリプトによって Terraform と Ansible がインストールされ、デプロイ機能が構成されます。

コントロール プレーンのセキュリティ保護

コントロール プレーンは、SAP オートメーション フレームワークで最も重要な部分です。 コントロール プレーンをセキュリティで保護することが重要です。 次の手順は、コントロール プレーンをセキュリティで保護するのに役立ちます。 外部の仮想マシンまたはクラウド シェルを使用してコントロール プレーンを作成している場合、ストレージ アカウントおよびキー コンテナー用のプライベート エンドポイントを実装して、コントロール プレーンをセキュリティで保護する必要があります。

このスクリプトを sync_deployer.sh 使用して、コントロール プレーン構成ファイルを配置者 VM にコピーできます。 デプロイ機能 VM にサインインして、次のコマンドを実行します。


cd ~/Azure_SAP_Automated_Deployment/WORKSPACES

../sap-automation/deploy/scripts/sync_deployer.sh --storageaccountname mgtneweeutfstate### --state_subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

DEPLOYER および LIBRARY 構成ファイルで、use_private_endpoint 変数が true に設定されていることを確認します。 DEPLOYER 構成ファイルで、public_network_access_enabledfalse に設定されていることも確認します。


# use_private_endpoint defines that the storage accounts and key vaults have private endpoints enabled
use_private_endpoint = true

# public_network_access_enabled controls if storage account and key vaults have public network access enabled
public_network_access_enabled = false

コントロール プレーンのデプロイを再度実行して、ストレージ アカウントおよびキー コンテナー用のプライベート エンドポイントを有効にします。



export            env_code="MGMT"
export         region_code="WEEU"
export           vnet_code="DEP00"
export  storageaccountname=<storageaccountname>

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

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

cd ~/Azure_SAP_Automated_Deployment/WORKSPACES

deployer_parameter_file="${CONFIG_REPO_PATH}/DEPLOYER/${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE/${env_code}-${region_code}-${vnet_code}-INFRASTRUCTURE.tfvars"
library_parameter_file="${CONFIG_REPO_PATH}/LIBRARY/${env_code}-${region_code}-SAP_LIBRARY/${env_code}-${region_code}-SAP_LIBRARY.tfvars"

${SAP_AUTOMATION_REPO_PATH}/deploy/scripts/deploy_controlplane.sh  \
    --deployer_parameter_file "${deployer_parameter_file}"         \
    --library_parameter_file "${library_parameter_file}"            \
    --subscription "${ARM_SUBSCRIPTION_ID}"                        \
    --spn_id "${ARM_CLIENT_ID}"                                    \
    --spn_secret "${ARM_CLIENT_SECRET}"                            \
    --tenant_id "${ARM_TENANT_ID}"                                 \
    --storageaccountname "${storageaccountname}"                   \
    --recover

Web アプリを用意する

この手順は省略可能です。 ブラウザーベースの UX で SAP ワークロードのゾーンとシステムの構成を支援する場合は、コントロール プレーンをデプロイする前に次のコマンドを実行します。

echo '[{"resourceAppId":"00000003-0000-0000-c000-000000000000","resourceAccess":[{"id":"e1fe6dd8-ba31-4d61-89e7-88639da4683d","type":"Scope"}]}]' >> manifest.json

region_code=WEEU

export TF_VAR_app_registration_app_id=$(az ad app create \
    --display-name ${region_code}-webapp-registration \
    --enable-id-token-issuance true \
    --sign-in-audience AzureADMyOrg \
    --required-resource-access @manifest.json \
    --query "appId" | tr -d '"')

export TF_VAR_webapp_client_secret=$(az ad app credential reset \
    --id $TF_VAR_app_registration_app_id --append               \
    --query "password" | tr -d '"')

export TF_VAR_use_webapp=true
rm manifest.json

次のステップ