From 3da27a01659a03d9919f6b1576500fec1b338a95 Mon Sep 17 00:00:00 2001 From: Giles Campbell Date: Thu, 2 Mar 2023 17:47:56 +0000 Subject: [PATCH 1/2] Add ability to pack as a dotnet tool --- .../ClrPro.AzureFX.LocalCredentialBridge.csproj | 5 +++++ src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json | 1 + 2 files changed, 6 insertions(+) diff --git a/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj b/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj index 251d11a..70de256 100644 --- a/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj +++ b/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj @@ -5,6 +5,11 @@ enable enable true + + true + true + az-credentials-bridge + ./nupkg diff --git a/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json b/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json index fe1f1a4..bac365c 100644 --- a/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json +++ b/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json @@ -5,6 +5,7 @@ "Microsoft.AspNetCore": "Warning" } }, + "ASPNETCORE_URLS": "http://+:40342", "LocalCredentialBridge": { "LocalTokensPath": "%USERPROFILE%/.LocalCredentialBridgeTokens", "RemoteTokensPath": "/var/opt/azcmagent/tokens", From 58fbbd068472057df606702a6d2e88f74fb48079 Mon Sep 17 00:00:00 2001 From: Giles Campbell Date: Thu, 2 Mar 2023 18:07:00 +0000 Subject: [PATCH 2/2] Add readme for running as dotnet tool and always default host to use port 40432 --- README.md | 13 +++++++++++++ .../ClrPro.AzureFX.LocalCredentialBridge.csproj | 2 +- src/ClrPro.AzureFX.LocalCredentialBridge/Program.cs | 2 ++ .../appsettings.json | 1 - 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0927f46 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Local Credentials Bridge + +## Using as a Dotnet Tool + +Luckily, WebApis can also be packaged as dotnet tools and ran. To do this simple use the following commands from the solution root. + +`dotnet pack` + +`dotnet tool update -g --add-source ./pack ClrPro.AzureFX.LocalCredentialBridge` + +Then run with the following command: + +`az-credentials-bridge` \ No newline at end of file diff --git a/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj b/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj index 70de256..6573937 100644 --- a/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj +++ b/src/ClrPro.AzureFX.LocalCredentialBridge/ClrPro.AzureFX.LocalCredentialBridge.csproj @@ -9,7 +9,7 @@ true true az-credentials-bridge - ./nupkg + ../../pack diff --git a/src/ClrPro.AzureFX.LocalCredentialBridge/Program.cs b/src/ClrPro.AzureFX.LocalCredentialBridge/Program.cs index f29ed77..332b45f 100644 --- a/src/ClrPro.AzureFX.LocalCredentialBridge/Program.cs +++ b/src/ClrPro.AzureFX.LocalCredentialBridge/Program.cs @@ -12,6 +12,8 @@ var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseUrls("http://+:40342"); + builder.Services.AddMemoryCache(); // Add services to the container. diff --git a/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json b/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json index bac365c..fe1f1a4 100644 --- a/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json +++ b/src/ClrPro.AzureFX.LocalCredentialBridge/appsettings.json @@ -5,7 +5,6 @@ "Microsoft.AspNetCore": "Warning" } }, - "ASPNETCORE_URLS": "http://+:40342", "LocalCredentialBridge": { "LocalTokensPath": "%USERPROFILE%/.LocalCredentialBridgeTokens", "RemoteTokensPath": "/var/opt/azcmagent/tokens",