Azure Data Studio コマンド ライン インターフェイス
重要
Azure Data Studio は、2026 年 2 月 28 日 に廃止されます。 私たちは Visual Studio Codeを使用することをお勧めします。 Visual Studio Code への移行の詳細については、「Azure Data Studio の概要」を参照してください。
Azure Data Studio には、アプリケーションの起動方法を制御できる、組み込みのコマンド ライン インターフェイスが含まれています。 コマンド ライン オプション (スイッチ) を使用して、ファイルを開いたり、拡張機能をインストールしたり、表示言語を変更したり、診断を出力したりできます。
Azure Data Studio 内でコマンド ライン ツールを実行する方法の例については、「統合ターミナル」を参照してください。
Note
Microsoft Entra ID はAzure Active Directory (Azure AD) の新しい名前ですが、既存の環境の中断を防ぐために、UI フィールド、接続プロバイダー、エラー コード、コマンドレットなど、ハードコーディングされた一部の要素でAzure AD が残ります。 この記事では、2 つの名前は交換可能です。
コマンド ライン ヘルプ
Azure Data Studio コマンド ライン インターフェイスの概要を表示するには、Azure Data Studio (> ターミナルの表示) 内でターミナルを開くか、コマンド プロンプトを開いて azuredatastudio --help
を入力します。 出力には、省略された例に示すように、バージョン、使用例、コマンド ライン オプションの一覧が含まれています。
Azure Data Studio 1.48.1
Usage: azuredatastudio.exe [options][paths...]
To read output from another program, append '-' (e.g. 'echo Hello World | azuredatastudio.exe -')
Options
<vscode options>
-h --help Print usage.
--aad Use Azure Active Directory authentication, this option is
deprecated - use 'authenticationType' instead.
-A --applicationName Supports providing applicationName
that will be used for connection profile app name.
-T --authenticationType Provide authentication mode to be
used. Accepted values: AzureMFA, SqlLogin, Integrated, etc.
-c --command <command-name> Name of command to run, accepted
values: connect, openConnectionDialog
-Z --connectionProperties Supports providing advanced connection properties that
providers support. Value must be a json object containing
key-value pairs in format: '{"key1":"value1"}'
-D --database <database> Name of database
-E --integrated Use Integrated authentication,
this option is deprecated - use 'authenticationType' instead.
-P --provider Connection provider to use, e.g. MSSQL, PGSQL, etc.
-S --server <server> Name of target server or host name.
--showDashboard Whether or not to show dashboard on connection, false by default.
-U --user <user-name> User name/email address
コマンド ラインから起動する
コマンド ラインから Azure Data Studio を起動して、ファイル、フォルダー、プロジェクトをすばやく開くことができます。 一般には、フォルダーのコンテキスト内で Azure Data Studio を開きます。 開いたターミナルまたはコマンド プロンプトからプロジェクト フォルダーに移動し、azuredatastudio
を入力します。
クエリ エディターを使用して起動する
Azure Data Studio を開くときに、クエリ エディターでスクリプトを開く必要がある場合があります。 ファイルのパスを指定することで、既存のスクリプトを使用して Azure Data Studio を起動できます。
azuredatastudio .\samplescript.sql
URI を使用して起動する
ブラウザーから URL 形式を使用して Azure Data Studio を起動すると、起動時に接続をすばやく確立したり、接続ダイアログを開いたりできます。必要に応じて、クエリ エディターでスクリプトを開きます。 URI を使用した起動にサポートされている形式は次のとおりです。
azuredatastudio://{command}?{option1}={value1}&{option2}={value2}...
サポートされているコマンド
コマンド ラインから Azure Data Studio を起動する際は、次のコマンドがサポートされます。
connect
: 指定されたオプションを使用してターゲット サーバーに接続します。openConnectionDialog
: 指定されたオプションを使用して接続ダイアログを開きます。
サポートされているオプション
URL には、次のオプションを指定できます。
オプション | 説明 |
---|---|
provider |
使用する接続プロバイダー (MSSQL、PGSQL など)。 |
server |
ターゲット サーバーの名前またはホスト名。 |
database |
データベースの名前。 |
user |
ユーザーの名前。 |
authenticationType |
使用する認証モード。使用できる値: AzureMFA 、SqlLogin 、Integrated など。 |
applicationName |
接続プロファイルで使用されるアプリケーション名を指定します。 |
connectionProperties |
プロバイダーがサポートする高度な接続プロパティ。 値は、{"key1":"value1"} 形式のキーと値のペアを含む json オブジェクトである必要があります。 |
例
コマンド プロンプト: 統合認証
azuredatastudio --server localhost --authenticationType Integrated
"信頼サーバー証明書" という警告が表示される場合があります。
Note
仮想マシン内のオンプレミスの SQL Server または SQL Server に接続するユーザーの場合、暗号化された接続をサポートするようにデータベース エンジンを構成する必要があります。 完全な手順については、「接続を暗号化するために SQL Server データベース エンジンを構成する」を参照してください。
コマンド プロンプト: 保存したスクリプトを使用して Azure Data Studio を起動する
azuredatastudio --server localhost --provider mssql --user sa .\samplescript.sql
Browser
azuredatastudio://connect?server=*****&user=*****&authenticationType=*****&connectionProperties={"key1":"value1"}