正式なドキュメントは英語版であり、この日本語訳はAI支援翻訳により作成された参考用のものです。日本語訳の一部の内容は人間によるレビューがまだ行われていないため、翻訳のタイミングにより英語版との間に差異が生じることがあります。最新かつ正確な情報については、英語版をご参照ください。

Microsoft Graph Mailer設定

  • プラン: Free、Premium、Ultimate
  • 提供形態: GitLab Self-Managed

前提条件:

  • Microsoft Graph APIを使用してメールを送信するには、まずAzure Active Directoryでアプリケーションを作成し、Mail.Send アプリケーションのアクセス許可を追加する必要があります。
  • アプリケーションのアクセス許可をApp-only accessに設定します。アクセス許可がDelegatedに設定されていないことを確認してください。

アプリケーションメールを送信する場合は、Microsoft Graph APIOAuth 2.0クライアント認証情報フローを使用して、次の設定情報を/etc/gitlab/gitlab.rbに追加し、gitlab-ctl reconfigureを実行してください。

# The originating email address for outgoing mail
gitlab_rails['gitlab_email_from'] = '<YOUR_ACCOUNT_EMAIL>'

# The reply-to email address
gitlab_rails['gitlab_email_reply_to'] = '<YOUR_ACCOUNT_EMAIL>'

gitlab_rails['microsoft_graph_mailer_enabled'] = true

# The unique identifier for the user. To use Microsoft Graph on behalf of the user.
gitlab_rails['microsoft_graph_mailer_user_id'] = "<YOUR_USER_ID>"

# The directory tenant the application plans to operate against, in GUID or domain-name format.
gitlab_rails['microsoft_graph_mailer_tenant'] = "<YOUR_TENANT_ID>"

# The application ID that's assigned to your app. You can find this information in the portal where you registered your app.
gitlab_rails['microsoft_graph_mailer_client_id'] = "<YOUR_CLIENT_ID>"

# The client secret that you generated for your app in the app registration portal.
gitlab_rails['microsoft_graph_mailer_client_secret'] = "<YOUR_CLIENT_SECRET_ID>"

gitlab_rails['microsoft_graph_mailer_azure_ad_endpoint'] = "https://login.microsoftonline.com"

gitlab_rails['microsoft_graph_mailer_graph_endpoint'] = "https://graph.microsoft.com"

トラブルシューティング

ErrorSendAsDenied

完全なエラーメッセージは次のとおりです:

"ErrorSendAsDenied","message":"The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message."

このエラーを解決するには:

  1. APIアクセス許可を確認して、アクセス許可が正しいことを検証するには、アプリケーションのアクセス許可を確認してください。
  2. 次のフィールドを使用しているアカウントのメールアドレスに設定します:
    • gitlab_rails['gitlab_email_from']
    • gitlab_rails['gitlab_email_reply_to']

アクセス許可以外にも、サーバーがデフォルトのgitlab_email_from値の使用を許可していないためにこのエラーが発生する場合があります。この値を、認証に使用するアカウントのメールアドレスに設定する必要があります。

Tail logs

トラブルシューティングの場合、tail logsコマンドを使用してライブのGitLabログの更新を表示します:

# Tail all logs for the application
sudo gitlab-ctl tail

# Tail logs for an application sub-directory
sudo gitlab-ctl tail gitlab-rails

# Tail logs for an individual file in the application
sudo gitlab-ctl tail nginx/gitlab_error.log

これらのコマンドを停止するには、Control+Cを押します。