Microsoft Azure にデプロイする
パイプを使用して、Microsoft Azure で Bitbucket Pipelines をさまざまな方法で使用できます。
次の Azure パイプを提供しています。
- Azure ARM deploy - Azure Resource Manager テンプレートを使用して Azure にリソースをデプロイします。
- Azure CLI Run - Azure CLI を使用してコマンドを実行します。
- Azure Functions Deploy - Azure 関数コードをデプロイします。
- Azure Kubernetes Service deploy - Kubectl を使用してAKS (Azure Kubernetes Service) にデプロイします。
- Azure Kubernetes Helm deploy - Helm を使用してAKS (Azure Kubernetes Service) にデプロイします。
- Azure Storage deploy - Microsoft Azure Storage にデプロイします。
- Azure VM Linux Script Deploy - Custom Script Extension Version 2 を使用して Azure VM でスクリプトを実行します。
- Azure VM Scale Set Linux script deploy - Custom Script Extension Version 2 を使用して Azure VM Scale Set でスクリプトを実行します。
- Azure Web containers deploy - コンテナを Azure Web Apps にデプロイします。
- Azure Web Apps deploy - アプリケーションを Azure Web Apps にデプロイします。
これらのパイプで bitbucket-pipelines.yml
をセットアップする方法についてのガイダンスが必要な場合は、リポジトリをご覧ください。
- example-azure-aks-deploy
- example-azure-aks-helm-deploy
- example-azure-arm-deploy
- example-azure-cli-run
- example-azure-functions-deploy
- example-azure-web-apps-containers-deploy
- example-azure-web-apps-deploy
パイプを使用する前に、いくつかの構成を行う必要があります。
認証情報のセットアップ
最初に、Azure リソースを構成する必要があります。最も一般的なのは、Azure CLI を使用する方法です。ローカル コンピューターに Azure CLI をインストールするか、Azure ポータルで提供される Azure Cloud Shell をブラウザで使用することができます。
サービス プリンシパルの作成
Azure App Service アプリを作成するのに十分なアクセス権を持つサービス プリンシパルを作成する必要があります。サービス プリンシパルは、Azure を操作するツールで使用できる ID です。次のコマンドを使ってサービス プリンシパルを作成します。
az ad sp create-for-rbac --name <プリンシパルの名前>
これにより、Bitbucket の変数 ([リポジトリ] > [設定] > [リポジトリ変数]) に追加できる値の一覧が表示されます。
ここで:
- appId → AZURE_APP_ID
- password → AZURE_PASSWORD
- tenant → AZURE_TENANT_I
詳しくは、サービス プリンシパルの作成についての Azure ドキュメントを参照してください。
これで、Azure パイプを使用する準備が整いました。bitbucket-pipelines.yml
ファイルをオンラインで編集してエディタからパイプを選択するか、パイプ リポジトリから直接スクリプトをコピーして貼り付けます。