Command-Line Interface (CLI) Installation
This guide provides step-by-step instructions for installing the Microsoft Command-Line Interface (CLI) tool, enabling you to interact with Microsoft services and manage your resources programmatically.
Prerequisites
- A compatible operating system (Windows, macOS, or Linux).
- Internet connectivity.
- Administrative privileges may be required for certain installation methods.
Installation Methods
Choose the installation method that best suits your environment.
Option 1: Using a Package Manager (Recommended)
Leverage your system's native package manager for a streamlined installation and update process.
Windows (winget)
winget install Microsoft.CLI
macOS (Homebrew)
brew install microsoft-cli
Linux (apt)
sudo apt-get update && sudo apt-get install microsoft-cli
Linux (dnf/yum)
sudo dnf install microsoft-cli
Option 2: Downloading the Binary
Download the latest executable binary for your operating system and add it to your system's PATH.
Visit the Releases Page to download the appropriate binary.
After downloading, ensure the executable is in a directory included in your system's PATH environment variable. For example, on Linux/macOS:
chmod +x mcli
sudo mv mcli /usr/local/bin/
Option 3: Using npm (Node.js Required)
If you have Node.js and npm installed, you can install the CLI globally.
npm install -g microsoft-cli
Ensure your npm global bin directory is in your PATH.
Verifying the Installation
Once the installation is complete, open a new terminal or command prompt window and run the following command to verify that the CLI is installed correctly and to check its version:
mcli version
You should see output similar to this:
CLI Version: 2.5.1
API Version: 1.0.0
Commit: abcdef1234567890
Build Date: 2023-10-27T10:30:00Z
Next Steps
Now that the CLI is installed, you can start managing your Microsoft resources. Explore the following topics: