Skip to content
| Marketplace
Sign in
Visual Studio Code>Data Science>Azure MySQL with Entra IDNew to Visual Studio Code? Get it now.
Azure MySQL with Entra ID

Azure MySQL with Entra ID

Temco Logistics

|
19 installs
| (0) | Free
Connect to Azure Database for MySQL using Microsoft Entra ID authentication
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Azure MySQL with Entra ID Authentication

A VS Code extension for connecting to Azure Database for MySQL Flexible Server using Microsoft Entra ID (formerly Azure AD) authentication.

Features

  • Entra ID Authentication: Automatically acquires and refreshes tokens using your Azure sign-in
  • Connection Management: Save and manage multiple MySQL connections
  • Query Editor: Execute SQL queries with results displayed in a table
  • Object Explorer: Browse tables and columns in the sidebar

Prerequisites

  1. Azure Resources Extension: Install the Azure Resources extension
  2. Sign in to Azure: Use the "Azure: Sign In" command in VS Code
  3. Azure Database for MySQL: A Flexible Server instance with Entra ID authentication enabled

Setup Azure MySQL for Entra ID Auth

Before using this extension, ensure your Azure Database for MySQL Flexible Server is configured:

  1. In the Azure Portal, go to your MySQL Flexible Server
  2. Navigate to Security → Authentication
  3. Set authentication to MySQL and Microsoft Entra authentication (or Entra only)
  4. Add a Microsoft Entra Admin (user or group)
  5. Create database users for Entra identities:
-- Connect as the Entra admin, then create users:
CREATE USER 'user@tenant.onmicrosoft.com' IDENTIFIED BY 'token';
GRANT ALL PRIVILEGES ON mydb.* TO 'user@tenant.onmicrosoft.com';

Usage

Add a Connection

  1. Click the Azure MySQL icon in the Activity Bar
  2. Click the + button or run "Azure MySQL: Add Connection"
  3. Enter connection details:
    • Name: A friendly name for the connection
    • Host: Your server hostname (e.g., myserver.mysql.database.azure.com)
    • Port: Usually 3306
    • Database: The database name
    • User: Your Entra ID username (e.g., user@tenant.onmicrosoft.com)
    • SSL: Yes (recommended for Azure)

Connect

  • Right-click a connection and select Connect
  • The extension will automatically acquire an Entra ID token
  • Once connected, the connection icon turns green and shows tables

Run Queries

  1. Right-click a connected server and select New Query
  2. Enter your SQL in the query editor
  3. Click Run Query or press Ctrl+Enter / Cmd+Enter
  4. Results display in a table below

How Authentication Works

  1. When you connect, the extension requests an access token for Azure Database for MySQL
  2. It uses VS Code's built-in Azure authentication (via the Azure Account extension)
  3. Falls back to Azure CLI (az login) if VS Code auth is unavailable
  4. Tokens are automatically refreshed before expiry (tokens valid 5-60 minutes)

Development

Build

cd azure-mysql-entra
npm install
npm run compile

Run in Debug Mode

  1. Open the extension folder in VS Code
  2. Press F5 to launch the Extension Development Host
  3. The extension will be available in the new VS Code window

Package as VSIX

npm install -g @vscode/vsce
vsce package

This creates azure-mysql-entra-0.1.0.vsix which can be installed locally.

Troubleshooting

"Failed to get Azure token"

  • Ensure you're signed in to Azure: Run "Azure: Sign In" command
  • Or sign in via CLI: az login

"Access denied for user"

  • Verify the user exists in the MySQL database
  • Check that Entra ID authentication is enabled on the server
  • Ensure your Entra ID user has the correct permissions

Connection timeout

  • Check firewall rules allow your IP address
  • Verify the server hostname and port are correct
  • Ensure SSL settings match server requirements

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft