---
title: "CLIのログインコマンド"
slug: "the-cli-login-command"
abstract: "DevEx CLIのログインコマンドを説明し、追加のCLIコマンドを含むプラグインを管理します。"
---
# CLIのログインコマンド

[Sitecore CLI](https://doc.sitecore.com/xp/ja/developers/100/developer-tools/sitecore-command-line-interface.html "Sitecore Command Line Interface")には、開発者がSitecoreインスタンスにログインできるloginコマンドが含まれています。

> !注Sitecore CLIのログインコマンドは[Sitecore Identity](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-manager/sitecore-identity.html)の使用が必要です。

## 使用例

Sitecore CLI loginコマンドはSitecore CLI内で以下の方法で起動されます。

dotnet sitecore login options

## オプション

loginコマンドで以下のオプションを利用できます:

オプション

必須ですか?

概要

\--authority, --auth

いいえ

環境の識別権限(アイデンティティサーバーやAADテナントURLなど)。

\--environment, -n

いいえ

使用Sitecore環境の名前付き。デフォルト: 'default'。

\--cm

いいえ

接続先はSitecoreコンテンツ管理ホスト名です。

\--allow-write

いいえ

環境へのデータ書き込みを有効にしてください。

\--client-credentials

いいえ

クライアントの認証情報(CI/CDや共有シークレット用)を使いましょう。

\--client-id

いいえ

送信するOAuth ClientIDです。デバイス認証はデフォルトで 'Device' 、クライアント認証は 'SitecoreCLIServer' です。

\--client-secret

いいえ

送信するOAuthクライアントの秘密。クライアント認証のみに使用されます。

\--config, -c

いいえ

ルート sitecore.json ディレクトリへのパス。デフォルト:現在の作業ディレクトリ。

\--help, -h, -?

いいえ

開発者のヘルプやコマンドの使用情報を表示します。

\--trace, -t

いいえ

コマンドに関する追加の診断や詳細な情報を出力します。

## 例

以下は、インタラクティブなユーザーログインにloginコマンドを使う例です:

-   コマンド:結果
-   dotnet sitecore login --authority https:// --cm http:// --allow-write truedotnet sitecore login: Output:

Logging in to Sitecore. You should see a browser window open shortly.
DeviceLogin User Code : 1234
DeviceLogin Authentication url : https://id.host.localhost/device?userCode=1234
DeviceLogin Authorization pending. Waiting.
DeviceLogin Authorization pending. Waiting.
Your login is complete. You can close the browser tab now.
Login information has been saved.

以下は、非インタラクティブなユーザーログインでloginコマンドを使う例です:

-   コマンド:説明
-   dotnet sitecore login --authority https:// --cm http:// --allow-write true --client-credentials true --client-id \--client-secret : 非 [インタラクティブなクライアントログイン](https://doc.sitecore.com/xp/ja/developers/100/developer-tools/configure-a-non-interactive-client-login.html)を使用。

詳細については、[CLIを使ってSitecoreインスタンスにログイン](https://doc.sitecore.com/xp/ja/developers/100/developer-tools/log-in-to-a-sitecore-instance-with-sitecore-command-line-interface.html "Log in to a Sitecore instance with Sitecore Command Line Interface")する方法を参照してください。