SlideShare a Scribd company logo
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
{
“名前” : “真壁 徹(まかべ とおる)”,
“所属” : “日本マイクロソフト株式会社”,
“役割” : “クラウド ソリューションアーキテクト”,
“経歴” : “大和総研  HP Enterprise”,
“特技” : “クラウド & オープンソース”
}
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
リソースグループ
Managed
Disk
仮想マシン
仮想
ネットワーク
(サブネット)
NIC
パブリック
IPアドレス
Web App
SQL
Database
クラシック リソースマネージャー
呼称 Azure Service Manager
(ASM)
Azure Resource Manager
(ARM)
バージョン V1 V2
リソースの表現や設定 XML JSON
GUI クラシックポータルから
Azureポータルへ移行中
Azureポータル
位置づけ 既存ユーザーの投資保護 推奨
小ネタ APIをRDFE(Red Dog Front
End)と呼ぶことも
※Red DogはAzure初期の
コードネーム
略が某CPUアーキテク
チャーと混乱しないよう、
文脈に注意
サーバー ストレージ ネットワーク Web App etc
Azure Resource Manager REST API
Azure ポータル
CLI
(PowerShell, Azure CLI)
SDK (C#, Node, Python, etc)
or Direct
ユーザー
コード
OSS / 3rd Party
ツール
ユーザー コード / スクリプト / 設定ファイル
リソースはJSONで表現
• https://management.azure.com/subscriptions/{s
ubscriptionId}/resourceGroups/{resourceGroup}
/providers/Microsoft.Compute/virtualMachines/
{vm}&api-version={apiVersion}
• HTTPメソッドで操作 (REST)
• 作成、更新はPUT
• 情報取得はGET
• 削除はDELETE
Azure Infrastructure as Code 体験入隊
サーバー ストレージ ネットワーク Web App etc
Azure Resource Manager REST API
Azure ポータル
CLI
(PowerShell, Azure CLI)
ユーザー
コード
OSS / 3rd Party
ツール
ユーザー コード / スクリプト / 設定ファイル
SDK (C#, Node, Python, etc)
or Direct
①Azure Resource Manager
テンプレート デプロイメント ②Terraform
③Ansible
Azure Infrastructure as Code 体験入隊
ARMテンプレート Terraform Ansible
開発リード Microsoft Hashicorp (OSS) Red Hat (OSS)
対応プラットフォーム Azure/Azure Stack マルチプラットフォーム マルチプラットフォーム
リソース記述形式 JSON HCL/JSON YAML
Azureリソース対応範囲 広 中 狭
依存ツール、SDK Azureポータル、もしくは
Azure CLI/PowerShell
Azure SDK for Go Azure SDK for Python
ARMテンプレート対応 ー 有り 有り
その他 新サービス、機能への追
従が早い
変数定義力が強い(出力結
果も容易に利用可)
Roleの再利用性が高く、
サンプルも豊富(Galaxy)
Azureの標準機能でワンス
トップサポート
HCLの可読性が高い PackerのProvisionerとし
ても使える
インフラ寄り アプリ・プラットフォームソフト寄り
ひとつのツールでやるべき? (できなくはないですが)
リソース
他CI/CDツールや
リポジトリ
ARMテンプレート
デプロイメント
Terraform +
ARMテンプレート
デプロイメント
インフラのデプロイ
アプリ&プラットフォームソフトの
デプロイと更新
Ansible
• アプリ&プラット
フォームソフトの
セットアップと更新
• VMカスタムイメージ
作成
Packer
ARMテンプレートで足元を固めて、他ツールも検討
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
ARMテンプレート
Azure ポータル
PowerShell /
Azure CLI
API
Endpoint
1. テンプレートを
作る
2. テンプレートを
投入する
3. 楽しみに
待つ
テンプレートの構造
←スキーマ定義URI。いまのところ固定。
←任意。ユーザーが決められる。 (1.0.0など)
←テンプレート実行時に動的に指定したい値。
←テンプレート内で使える変数。複数回参照される値など。
←作成するリソースの定義。
←実行終了時に出力したい値。
テンプレート例 (Azure Container Instances)
####続く####
テンプレート例 (Azure Container Instances)
####続き####
####続く####
テンプレート例 (Azure Container Instances)
####続き - 途中省略####
####途中省略####
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-authoring-templates
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-template-functions
https://raw.githubusercontent.com/ToruMakabe/AA_IaC_Workshop/master/aci/template01.json
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
ARMテンプレート
+パラメータ
Azure ポータル
PowerShell /
Azure CLI
API
Endpoint
1. テンプレートと
パラメータを作る
2. テンプレートと
パラメータを投入
する
3. 楽しみに
待つ
Azure Infrastructure as Code 体験入隊
テンプレート例 (Azure Container Instances)
####省略####
####省略####
####省略####
パラメータ例 (Azure Container Instances)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"containerImage": {
"value": "httpd:alpine"
}
}
}
https://raw.githubusercontent.com/ToruMakabe/AA_IaC_Workshop/master/aci/template02.json
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
https://code.visualstudio.com/download https://marketplace.visualstudio.com/items?itemName
=msazurermtools.azurerm-vscode-tools
Azure CLI or PowerShell ランタイム/環境 導入形式
Windows Azure CLI Python MSI
Windows Subsystem for
Linux
各パッケージマネージャ /
マニュアル
Docker Docker
PowerShell WMF PowerShellGet(推奨)
macOS Azure CLI Python Homebrew / マニュアル
Docker Docker
PowerShell (ベータ) .NET Core PowerShellGet(推奨)
Linux Azure CLI Python 各パッケージマネージャ /
マニュアル
PowerShell (ベータ) .NET Core PowerShellGet(推奨)
Azure Cloud Shell Azure CLI ブラウザ インストール済み
PowerShell (Preview) ブラウザ インストール済み
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Windows macOS
VS Code VS Code
Azure系
拡張
その他拡張
(言語系など)
Settings Sync
拡張
Azure系
拡張
その他拡張
(言語系など)
Settings Sync
拡張
Windows macOS
ブラウザ WSL PowerShell ブラウザ
Azure CLI
(メイン)
Azure CLI
(メイン)
Cloud Shell Cloud Shell
Azure
CLI
PowerS
hell
Azure CLI PowerShell
"terminal.integrated.shell.windows": "C:¥¥windows¥¥sysnative¥¥bash.exe“)
https://code.visualstudio.com/download
https://docs.microsoft.com/ja-jp/cli/azure/install-azure-cli?view=azure-cli-latest
https://docs.microsoft.com/ja-jp/powershell/azure/install-azurerm-ps?view=azurermps-5.0.0
https://docs.microsoft.com/ja-jp/azure/azure-resource-
manager/resource-manager-vscode-extension
"outputs": {
"groupLocation": {
"type": "string",
"value": "[resourceGroup().location]"
},
"storageUri": {
"type": "string",
"value":
"[reference(concat('Microsoft.Storage/storageAccounts/',variables('stora
geName'))).primaryEndpoints.blob]"
}
}
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
https://github.com/ToruMakabe/AA_IaC_Workshop
https://azure.microsoft.com/en-us/resources/templates/
https://github.com/ToruMakabe/ImpressAzureBook
ざっと眺めてみて、楽しそうなものを試してください
https://github.com/Azure/azure-quickstart-templates
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
https://azure.microsoft.com/ja-jp/regions/services/
Azure Infrastructure as Code 体験入隊
–n hoge01 …
PowerShell: New-AzureRmResourceGroupDeployment –Name hoge01 …
例: デプロイ毎に違う名前でストレージアカウントを作りたい
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-template-functions-string#concat
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-template-functions-string#uniquestring
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-define-dependencies#dependson
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-template-functions-numeric#copyindex
https://docs.microsoft.com/ja-
jp/azure/architecture/best-
practices/naming-conventions
Azure Infrastructure as Code 体験入隊
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-linked-templates
https://docs.microsoft.com/ja-
jp/azure/templates/microsoft.auto
mation/automationaccounts
Azure Infrastructure as Code 体験入隊
https://github.com/ToruMakabe/ImpressAzureBook/tree/master/NodeIaaS
https://github.com/ToruMakabe/ImpressAzureBook/tree/master/NodeIaaS
• リソースが既にリソース グループに存在しており、その設定が変更されていない場合、操作の結果に変わりは
ありません。
• リソースの設定を変更した場合、リソースはそれらの新しい設定でプロビジョニングされます。
• 既存のリソースの場所または種類を更新しようとすると、デプロイがエラーで失敗します。
• 後から変更できない属性があります。(VMのimageReferenceなど)
• ARMの管理範囲を外れるものは注意してください。 (VM拡張機能など。例: 拡張はインストールされたがその
設定中にエラーで終了。再実行したら拡張がすでに入っているので失敗)
• 既存リソースの変更は、必ず別環境で検証しましょう。新規作成→並行運用→切り替えの方が楽かも。
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-template-deploy-cli
Azure Infrastructure as Code 体験入隊
Azure Infrastructure as Code 体験入隊
https://docs.microsoft.com/ja-jp/azure/azure-resource-manager/resource-group-overview
https://docs.microsoft.com/en-us/rest/api/
https://github.com/Azure/azure-resource-manager-schemas
© 2017 Microsoft Corporation. All rights reserved.
本情報の内容(添付文書、リンク先などを含む)は、作成日時点でのものであり、予告なく変更される場合があります。

More Related Content

PDF
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
PDF
M08_あなたの知らない Azure インフラの世界 [Microsoft Japan Digital Days]
PDF
Azure Monitor Logで実現するモダンな管理手法
PDF
Terraform Bootcamp - Azure Infrastructure as Code隊
PDF
20200219 AWS Black Belt Online Seminar オンプレミスとAWS間の冗長化接続
PDF
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
PPTX
20220409 AWS BLEA 開発にあたって検討したこと
PDF
Ingress on Azure Kubernetes Service
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
M08_あなたの知らない Azure インフラの世界 [Microsoft Japan Digital Days]
Azure Monitor Logで実現するモダンな管理手法
Terraform Bootcamp - Azure Infrastructure as Code隊
20200219 AWS Black Belt Online Seminar オンプレミスとAWS間の冗長化接続
[AWS EXpert Online for JAWS-UG 18] 見せてやるよ、Step Functions の本気ってやつをな
20220409 AWS BLEA 開発にあたって検討したこと
Ingress on Azure Kubernetes Service

What's hot (20)

PDF
Managed Service Provider(MSP)によるマルチOrganizations管理の裏側(Security JAWS 第24回 発表資料)
PDF
20190806 AWS Black Belt Online Seminar AWS Glue
PPTX
Azure AD とアプリケーションを SAML 連携する際に陥る事例と対処方法について
PDF
Infrastructure as Code (IaC) 談義 2022
PDF
Azure Network Security Group(NSG) はじめてのDeep Dive
PPTX
ぱぱっと理解するSpring Cloudの基本
PDF
コスト最適化概論
PDF
わかる!metadata.managedFields / Kubernetes Meetup Tokyo 48
PDF
20200811 AWS Black Belt Online Seminar CloudEndure
PDF
20190226 AWS Black Belt Online Seminar Amazon WorkSpaces
PDF
マルチテナントのアプリケーション実装〜実践編〜
PPTX
Azure Cosmos DB のキホンと使いドコロ
PDF
20190522 AWS Black Belt Online Seminar AWS Step Functions
PDF
3分でわかるAzureでのService Principal
PDF
今こそ知りたい!Microsoft Azureの基礎
PPTX
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
PDF
20190911 AWS Black Belt Online Seminar AWS Batch
PPTX
AWSメンテナンス ElastiCache編
PDF
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
PPTX
はじめてのElasticsearchクラスタ
Managed Service Provider(MSP)によるマルチOrganizations管理の裏側(Security JAWS 第24回 発表資料)
20190806 AWS Black Belt Online Seminar AWS Glue
Azure AD とアプリケーションを SAML 連携する際に陥る事例と対処方法について
Infrastructure as Code (IaC) 談義 2022
Azure Network Security Group(NSG) はじめてのDeep Dive
ぱぱっと理解するSpring Cloudの基本
コスト最適化概論
わかる!metadata.managedFields / Kubernetes Meetup Tokyo 48
20200811 AWS Black Belt Online Seminar CloudEndure
20190226 AWS Black Belt Online Seminar Amazon WorkSpaces
マルチテナントのアプリケーション実装〜実践編〜
Azure Cosmos DB のキホンと使いドコロ
20190522 AWS Black Belt Online Seminar AWS Step Functions
3分でわかるAzureでのService Principal
今こそ知りたい!Microsoft Azureの基礎
はじめてのAzure Web App for Containers! -コンテナの基礎から DevOps 環境の構築まで-
20190911 AWS Black Belt Online Seminar AWS Batch
AWSメンテナンス ElastiCache編
Kubernetesのしくみ やさしく学ぶ 内部構造とアーキテクチャー
はじめてのElasticsearchクラスタ
Ad

Similar to Azure Infrastructure as Code 体験入隊 (20)

PDF
MicrosoftのOSSへの取り組み
PDF
Azure でサーバーレス、 Infrastructure as Code どうしてますか?
PDF
ARMテンプレートでサーバーレスに挑む!
PDF
INF-011_驚愕! Azure リソース マネージャを利用した Infrastructure as Code 実践
PDF
ArcBox のおさらいと最新情報
PDF
AnsibleでAzureの インフラを管理する話 + α
PDF
Azure IaaS update (2018年6月~7月 発表版)
PDF
20191209 hccjp azure-stackhub_overview
PPTX
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
PPTX
DevOps on azure 高品質クラウドデザインを求めて
PPTX
Azure VMware Solution (AVS) 概要 (2019年11月版)
PDF
Azure IaaS update (2019年1月~2月 発表版)
PDF
今日から始めるARMテンプレート
PDF
Building andobservingcloudnativeappliactionusingazure elastic-terraform
PDF
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
PDF
Azure IaaS update (2018年6月~8月 発表版)
PDF
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
PDF
Azure IaaS 解説
PDF
Azure and cloud native approach.v0.6.19.0807
PPTX
Azure Arc Virtual MachineとAzure Arc Resource Bridge / VM provisioning through...
MicrosoftのOSSへの取り組み
Azure でサーバーレス、 Infrastructure as Code どうしてますか?
ARMテンプレートでサーバーレスに挑む!
INF-011_驚愕! Azure リソース マネージャを利用した Infrastructure as Code 実践
ArcBox のおさらいと最新情報
AnsibleでAzureの インフラを管理する話 + α
Azure IaaS update (2018年6月~7月 発表版)
20191209 hccjp azure-stackhub_overview
15分でお届けする Elastic Stack on Azure 設計・構築ノウハウ
DevOps on azure 高品質クラウドデザインを求めて
Azure VMware Solution (AVS) 概要 (2019年11月版)
Azure IaaS update (2019年1月~2月 発表版)
今日から始めるARMテンプレート
Building andobservingcloudnativeappliactionusingazure elastic-terraform
2021/03/19 パブリッククラウドを活かす運用プロセス自動化
Azure IaaS update (2018年6月~8月 発表版)
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
Azure IaaS 解説
Azure and cloud native approach.v0.6.19.0807
Azure Arc Virtual MachineとAzure Arc Resource Bridge / VM provisioning through...
Ad

More from Toru Makabe (20)

PDF
インフラ廻戦 品川事変 前夜編
PDF
細かすぎて伝わらないかもしれない Azure Container Networking Deep Dive
PDF
Demystifying Identities for Azure Kubernetes Service
PDF
Azure Blueprints - 企業で期待される背景と特徴、活用方法
PDF
ミッション : メガクラウドを安全にアップデートせよ!
PDF
俺の Kubernetes Workflow with HashiStack
PDF
Resilience Engineering on Kubernetes
PDF
俺とHashiCorp
PDF
Real World Azure RBAC
PDF
Azure Kubernetes Service 2019 ふりかえり
PDF
インフラ野郎AzureチームProX
PDF
NoOps Japan Community 1st Anniversary 祝辞
PDF
ZOZOTOWNのCloud Native Journey
PDF
Ops meets NoOps
PDF
Essentials of container
PDF
インフラ野郎 Azureチーム at クラウド boost
PDF
ダイ・ハード in the Kubernetes world
PDF
半日でわかる コンテナー技術 (応用編)
PDF
インフラエンジニア エボリューション ~激変する IT インフラ技術者像、キャリアとスキルを考える~ at Tech Summit 2018
PDF
インフラ野郎 Azureチーム v18.11 at Tech Summit 2018
インフラ廻戦 品川事変 前夜編
細かすぎて伝わらないかもしれない Azure Container Networking Deep Dive
Demystifying Identities for Azure Kubernetes Service
Azure Blueprints - 企業で期待される背景と特徴、活用方法
ミッション : メガクラウドを安全にアップデートせよ!
俺の Kubernetes Workflow with HashiStack
Resilience Engineering on Kubernetes
俺とHashiCorp
Real World Azure RBAC
Azure Kubernetes Service 2019 ふりかえり
インフラ野郎AzureチームProX
NoOps Japan Community 1st Anniversary 祝辞
ZOZOTOWNのCloud Native Journey
Ops meets NoOps
Essentials of container
インフラ野郎 Azureチーム at クラウド boost
ダイ・ハード in the Kubernetes world
半日でわかる コンテナー技術 (応用編)
インフラエンジニア エボリューション ~激変する IT インフラ技術者像、キャリアとスキルを考える~ at Tech Summit 2018
インフラ野郎 Azureチーム v18.11 at Tech Summit 2018

Azure Infrastructure as Code 体験入隊