CloudSql.Connector.Npgsql 1.3.0

dotnet add package CloudSql.Connector.Npgsql --version 1.3.0
                    
NuGet\Install-Package CloudSql.Connector.Npgsql -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CloudSql.Connector.Npgsql" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CloudSql.Connector.Npgsql" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="CloudSql.Connector.Npgsql" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CloudSql.Connector.Npgsql --version 1.3.0
                    
#r "nuget: CloudSql.Connector.Npgsql, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CloudSql.Connector.Npgsql@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CloudSql.Connector.Npgsql&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=CloudSql.Connector.Npgsql&version=1.3.0
                    
Install as a Cake Tool

CloudSql.Connector

In-process Google Cloud SQL connector for .NET — connect to Cloud SQL for PostgreSQL or MySQL directly from your application over mTLS, with no Cloud SQL Auth Proxy binary or sidecar process.

This is the in-process connector .NET has been missing — the equivalent of Google's Go, Java, and Python connectors.

What it does

  • Discovers instance metadata via the Cloud SQL Admin API (connectSettings).
  • Mints and automatically rotates a short-lived client certificate (generateEphemeralCert) ahead of expiry.
  • Performs the mTLS handshake to the instance itself (port 3307), validating the server against the instance CA and identity (legacy CN or CAS SAN).
  • Exposes an in-process loopback endpoint any ADO.NET driver can connect to.
  • Supports IAM database authentication (access-token passwords, auto-refreshed).
  • Selects public, private (VPC), or PSC IPs.

Packages

Package Use
CloudSql.Connector Core connector + raw mTLS dialer + DI.
CloudSql.Connector.Npgsql NpgsqlDataSource for Cloud SQL for PostgreSQL.
CloudSql.Connector.MySqlConnector MySqlDataSource for Cloud SQL for MySQL.

Quick start (PostgreSQL)

using CloudSql.Connector;
using CloudSql.Connector.Npgsql;

await using var connector = await CloudSqlConnector.CreateAsync();

await using var dataSource = await connector.CreateCloudSqlDataSourceAsync(
    "my-project:europe-west1:my-instance",
    "Database=mydb;Username=postgres;Password=...");

await using var cmd = dataSource.CreateCommand("SELECT version();");
Console.WriteLine(await cmd.ExecuteScalarAsync());

Dependency injection

builder.Services.AddCloudSqlNpgsqlDataSource(
    "my-project:europe-west1:my-instance",
    "Database=mydb;Username=postgres;Password=...");

Authentication uses Application Default Credentials.

See the project README for full documentation, IAM auth, private IP, and how it works.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 110 8/11/2026
1.2.0 138 6/19/2026
1.1.0 117 6/19/2026
1.0.0 118 6/19/2026