Introducing Package Source Mapping

We’re happy to announce the first preview release of Package Source Mapping with Visual Studio 2022 preview 4! Package Source Mapping gives you fine-grained control of where your packages come from by mapping every package in your solution to a target package source.The post Introducing Package Source Mapping appeared first on The NuGet Blog.

Get a secure baseline architecture for Azure Kubernetes Service (AKS)

Derek Martin joins Scott Hanselman to discuss the Azure Kubernetes Service (AKS) Secure Baseline reference implementation from the Azure Architecture Center.  Learn what it is, how it works, and how you can use it to start your production deployment in a secure and compliant manner.  You'll also learn about the available additions for Payment Card Industry Data Security Standard (PCI-DSS 3.2.1) compliance and multi-region cluster support.[0:00:00]– Introduction[0:00:36]– Overview [0:02:41]– Getting to a production-ready, secure baseline[0:06:47]– Making it your own[0:10:12]– Multiregion clusters[0:12:38]– PCI-DSS compliance[0:15:23]– Wrap-upAzure Architecture CenterBaseline architecture for an Azure Kubernetes Service (AKS) clusterAKS baseline for multiregion clustersIntroduction of an AKS regulated cluster for PCI-DSS 3.2.1Azure Kubernetes Service (AKS) Baseline Cluster (GitHub)Create a free account (Azure)

Eliminate data silos with NFS 3.0 support for Azure Blob Storage

Yuan Zheng joins Scott Hanselman to discuss and demonstrate Blob storage support for the NFS 3.0 protocol, which enables you to run your applications on a single storage platform.  With no application rewrites necessary you will also help eliminate data silos.[0:00:00]– Introduction[0:02:00]– Overview of NFS v3[0:04:42]– Demo: Enabling NFSv3 in your Storage account[0:05:49]– Demo: Secure access using virtual networks[0:07:20]– Demo: Blob storage compatibility with VMs using NFS v3[0:09:12]– Demo: Writing to Blob storage from within a VM[0:12:45]– Wrap-upModernize large-scale NFS workloads and eliminate data silos with Azure Blob StorageNetwork File System (NFS) 3.0 protocol support in Azure Blob StorageAzure Blob Storage overviewConfigure blob storage – Microsoft Learn moduleCreate a free account (Azure)

My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal

I've long blogged about my love of setting up a nice terminal, getting the prompt just right, setting my colors, fonts, glyphs, and more. Here's some of my posts. How to make a pretty prompt in Windows Terminal with Powerline, Nerd Fonts, Cascadia Code, WSL, and oh-my-posh Patching the new Cascadia Code to include Powerline Glyphs and other Nerd Fonts for the Windows Terminal What's the difference between a console, a terminal, and a shell? Taking your PowerShell prompt to the next level with Windows Terminal and Oh my Posh 3 I want to take a moment to update my pretty prompt post with a little more detail and a more complex PowerShell $PROFILE, due to some changes in Oh My Posh, PowerShell, and the Windows Terminal. I doubt that this post is perfect and I'm sure there's stuff here that is a little extra. But I like it, and this post will serve as my "setting up a new machine" post until I get around to writing a script to do all this for me in one line. I love my prompt. Let's get you set up! Get PowerShell I don't mean Windows PowerShell (that's "classic" now) I mean the .NET Core-powered cross-platform PowerShell. There's a LOT of ways to get it but I'm a Store person usually so I can get PowerShell (and it'll auto update) from the Microsoft Store or just "winget install Microsoft.PowerShell" from the command line with winget. Get Windows Terminal and set a default Shell Get Windows Terminal if you don't already have it, you can get Windows Terminal free from the Store. If you don't have access to the Microsoft Store, the builds are published on the GitHub releases page. It comes with a lovely font called Cascadia Code...but... Now that you have Windows Terminal, you'll notice that it knows that you have PowerShell installed and will add it to your Windows Terminal dropdown menu! You can set PowerShell as your default Profile - that's the one you'll get by default when you make a new Tab - in settings: Upgrade your Terminal/Console Fonts I like fonts with lots of Glyphs so I also download and Install Caskaydia Cove Nerd Font Complete. This is the same Cascadia Code font but MODIFIED to include hundreds of special characters that you can use to make your prompt cooler. IMPORTANT NOTE: The string literal name of this font for use in settings or VS Code is "CaskaydiaCove NF". If you're using Cascadia Code, there are different strings for each. The NUMBER ONE question I get is 'why don't my glyphs/fonts show up right in Windows Terminal/VS Code?' and the answer is almost always "you're using the wrong font string." It's usually either an extra space or a missing space, so don't be afraid to double check. Remember that Windows Terminal has a lovely Settings UI but you can always click "open JSON file" to manage the settings.json as text if you prefer. Here's mine. Yours will be different and you should customize it! The Windows Terminal documentation is fantastic. Again, see how PowerShell is in BOLD? That's because it's my default. Now, let's add a little...spice... Add "Oh My Posh" to your Shell Oh My Posh has amazing docs so check them out. Do note that some stuff has changed, especially from v2 to v3. EXCITING NOTE: Oh My Posh is portable and works on any shell, so I use it on both my "Pwsh" (PowerShell) in Windows and my Bash shells on WSL running Ubuntu. You can install Oh My Posh with with PowerShell's "Install-Module" or with the platform-specific install instructions. I used the latter, which is somewhat new, but it's tomato/tomato, so use what works for you. Again, read the docs but the idea on Windows is basically this (or get it from GitHub):winget install JanDeDobbeleer.OhMyPosh# restart shell to reload PATHThen edit $PROFILE and add the following line, remembering at this point that oh-my-posh is an executable on the PATH. oh-my-posh --init --shell pwsh --config ~/jandedobbeleer.omp.json | Invoke-ExpressionI have changed my Oh My Posh from Jan's default to include my own stuff, and I keep my latest up in a GitHub Gist and also in my DropBox/OneDrive so it's always syncing to all my machines. Mine is this, after I download from my gist.oh-my-posh --init --shell pwsh --config D:/Dropbox/ohmyposhv3-2.json | Invoke-ExpressionYours will vary. Again, read the docs and experiment! Once added, reload your profile for the changes to take effect, or restart your shell.. $PROFILEThat .json file is filled with "segments" that are documented on the Oh My Posh site in a lot of detail. Overwhelming detail. You can add your computer's battery, your Azure Subscription, the dotnet or node version of your current folder, really anything. Even your Spotify songs. I'm going to make one that show my Blood Sugar.Go explore Oh My Posh Themes and then modify them with your own additional Segments.Again, note that your fonts will need the right glyphs or it will look weird.Here's a GOOD prompt: Here's a BAD prompt with an issue! Why is it wrong? Either the .json file that is your config has been saved wrong or corrupted the Unicode Glyphs, or you've got a font that doesn't have those glyphs. Re-assert your Git segment in Oh My PoshSome folks want full git info, status, added, modified, untracked, etc and others just want the current git branch. Check the Git segment and the Posh Git segment to make sure you are getting the performance AND information you need.I needed to turn on "display_stash_count" and "display_upstream_icon" in my config json, like this:{ "type": "git", "style": "powerline", "powerline_symbol": "", "invert_powerline": false, "foreground": "#193549", "background": "#fffb38", "leading_diamond": "", "trailing_diamond": "", "properties": { "display_status": true, "display_stash_count": true, "display_upstream_icon": true }},Again, this is all optional and affect performance slightly, but be aware of these properties. I believe I have these set the right way I want them in my public gist. Here is me moving around my source code with "z" in stead of cd, but note the prompt changes. Turn your PowerShell directories up to 11 with Terminal-Icons Is your prompt not extra enough? That's because your directory listing needs color AND cool icons!Install-Module -Name Terminal-Icons -Repository PSGalleryAnd then add one line to my $profile (edit with "code $profile"):Import-Module -Name Terminal-IconsSweet! How far is too far?At this point you're basically done, but I also LOVE PSReadLine. It's great generally but also nice for bash and Emacs types who are moving to PowerShell or use PowerShell for work. I've added features like "ctrl shift b" at the command line will run "dotnet build." Why? Because I can and because it's muscle memory so I'm making my prompt work for me.You can also add Predictive Autocomplete to your prompt if you like but I'll leave that as an exercise to the reader! My PowerShell profile is on a public gist, and while it's not perfect and likely has issues, it works for me!Enjoy! Thanks to the Windows Terminal Team and the always lovely Jan De Dobbeleer from Oh My Posh, as well as Brandon Olin from Terminal Icons.Check out our Sponsor! YugabyteDB is a distributed SQL database designed for resilience and scale. It is 100% open source, PostgreSQL-compatible, enterprise-grade, and runs across all clouds. Sign up and get a free t-shirt!© 2021 Scott Hanselman. All rights reserved.     

Quantum-inspired algorithms and the Azure Quantum optimization service

Delbert Murphy joins Scott Hanselman to show how quantum-inspired algorithms mimic quantum physics to solve difficult optimization problems. Quantum-Inspired Optimization (QIO) takes state-of-the-art algorithmic techniques from quantum physics and makes these capabilities available in Azure on conventional hardware, and callable from a Python client. You can use QIO to solve problems with hundreds of thousands of variables, combined into millions of terms, in a few minutes, with this easy-to-consume Azure service.[0:00:00]– Introduction [0:00:40]– What problems can you solve with quantum-inspired optimization?[0:05:35]– A concrete example: Secret Santa[0:08:52]– Demo, Part I: Solving Secret Santa with QIO[0:17:58]– Demo, Part II: Running the code[0:21:12]– Quantum-inspired algorithms[0:24:33]– Wrap-up Solve optimization problems by using quantum-inspired optimizationWhat are quantum-inspired algorithms?Ising formulations of many NP problems (Cornell University)A Tutorial on Formulating and Using QUBO Models (Cornell University)Sample code: delbert/secret-santa (GitHub)Azure Quantum optimization service samples (GitHub)Create a free account (Azure)

Hanselminutes is Fresh Air for Developers and has over 800 episodes of fresh tech from fresh faces

Hey friends! I wanted remind you about my podcast! It's http://hanselminutes.com/ and just a few weeks ago I published my 800th episode! My first episode was in January of 2006 so that's over 15 years of shows. And, if I may be a little boastful for a moment, they are pretty darn good. Maybe the first 400 were a little rough but these last 400 have been ROCK SOLID. Just kidding. Seriously, though, this 30 minute long tech show has diverse topics and new faces you haven't heard on other podcasts. If you check out over 800 episodes here https://www.hanselminutes.com/episodes you can search by Title, Guest, OR search all the Transcripts! There's over 400 hours of shows and you can search for the topics you want. Subscribe with your favorite podcast app, the raw RSS is here. We're also available on basically every podcast app out there, including, but not limited to: iTunes Spotify Google Podcasts TuneIn iHeart Stitcher Player.FM Samsung Podcasts, and more! If you enjoy the show, the best thing you can do to help me is SPREAD THE WORD! Tell a friend, share and episode or favorite code, but above all GET FOLKS TO SUBSCRIBE. The world is littered with podcasts that gave up after 9 episodes. There's a ton of average talks shows that ramble on. I've worked really hard - at night, as this is not my day job! - to not only bring you the best guests, but to read their papers, books, and thesis, and ask the questions that YOU would have if you were here with me! Sometimes I even put the Hanselminutes Podcast on YouTube and the results are truly special and heartbreakingly emotional. Thanks for listening, and thanks for sharing! Sponsor: YugabyteDB is a distributed SQL database designed for resilience and scale. It is 100% open source, PostgreSQL-compatible, enterprise-grade, and runs across all clouds. Sign up and get a free t-shirt© 2021 Scott Hanselman. All rights reserved.     

Accelerate time to insights with Azure Synapse Link for Dataverse

Josh Caplan, Sabin Nair, and Priyanka Langade join Scott Hanselman to show how you can use native Azure Synapse Analytical runtimes to analyze Dataverse data and get actionable insights.  Dataverse structures a variety of data and business logic to support interconnected applications and processes in a secure and compliant manner.  Azure Synapse Link for Dataverse is the fastest path to success for you to slice and dice large volumes of Dataverse data and run AI and ML on it. [0:00:00]– Intro[0:00:51]– Josh Caplan: Overview[0:03:20]– Sabin Nair: Dataverse and the Power Apps Portal[0:08:32]– Priyanka Langade: Azure Synapse Link for Dataverse[0:12:51]– Josh Caplan: Wrap-upAccelerate time to insight with Azure Synapse Link for DataverseWhat is Azure Synapse Link for Dataverse?Link a Microsoft Dataverse environment to Azure Synapse Analytics workspace and bring Dynamics 365 data to AzureCreate an Azure Synapse Link for Dataverse with your Azure Synapse Workspace (Preview)Microsoft Azure Synapse Link for Dataverse integration (YouTube)Create a free account (Azure)

Carter Community for ASP.NET Core means enjoyable Web APIs on the cutting edge

I blogged about the open source Carter Community Project in 2019. Let's check in and see what's going on today in 2021! The open source Carter Community Project adds opinionated elegance to ASP.NET Core routing With .NET 6 on the near horizon, one notes that Carter has a net6 branch. Per their website, this is the goal of the Carter framework: Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable. As of today you can bring Carter into your .NET 6 projects like this:dotnet add package Carter --version 6.0.0-pre2And the .NET 6 samples are under active development! Let's bring it down with a clone, switch to the net6 branch and give it a go. Here's as simple Web API sample with Carter that returns a list of actors at localhost:5001/actorsusing Carter;using CarterSample.Features.Actors;using Microsoft.AspNetCore.Builder;using Microsoft.Extensions.DependencyInjection;var builder = WebApplication.CreateBuilder(args);builder.Services.AddSingleton<IActorProvider, ActorProvider>();builder.Services.AddCarter();var app = builder.Build();app.MapCarter();app.Run();Nice! This is using new .NET 6 features so there's no Main(), it's implied. The builder has an ActorProvider added as a Singleton. I bet we'll use that when we ask for /actors in our browser or favorite HTTP API client.public class ActorsModule : ICarterModule{ public void AddRoutes(IEndpointRouteBuilder app) { app.MapGet("/actors", (IActorProvider actorProvider, HttpResponse res) => { var people = actorProvider.Get(); return people; }); ... }}This is nice and clean. Everything is using Dependency Injection so no one is "newing up" an Actor. You'll note also that returning the Actors as JSON is implied when we return the IEmumerable<Actor> that comes from actorProvider.Get().In fact, the whole Actor Module is just 80 lines so I'll include it here:public class ActorsModule : ICarterModule{ public void AddRoutes(IEndpointRouteBuilder app) { app.MapGet("/actors", (IActorProvider actorProvider, HttpResponse res) => { var people = actorProvider.Get(); return people; }); app.MapGet("/actors/{id:int}", (int id, IActorProvider actorProvider, HttpResponse res) => { var person = actorProvider.Get(id); return res.Negotiate(person); }); app.MapPut("/actors/{id:int}", async (HttpRequest req, Actor actor, HttpResponse res) => { var result = req.Validate<Actor>(actor); if (!result.IsValid) { res.StatusCode = 422; await res.Negotiate(result.GetFormattedErrors()); return; } //Update the user in your database res.StatusCode = 204; }); app.MapPost("/actors", async (HttpContext ctx, Actor actor) => { var result = ctx.Request.Validate<Actor>(actor); if (!result.IsValid) { ctx.Response.StatusCode = 422; await ctx.Response.Negotiate(result.GetFormattedErrors()); return; } //Save the user in your database ctx.Response.StatusCode = 201; await ctx.Response.Negotiate(actor); }); app.MapDelete("/actors/{id:int}", (int id, IActorProvider actorProvider, HttpResponse res) => { actorProvider.Delete(id); return Results.StatusCode(204); }); app.MapGet("/actors/download", async (HttpResponse response) => { using (var video = new FileStream("earth.mp4", FileMode.Open)) //24406813 { await response.FromStream(video, "video/mp4"); } }); app.MapGet("/empty", () => Task.CompletedTask); app.MapGet("/actors/sample", () => Task.CompletedTask); app.MapPost("/actors/sample", () => Task.CompletedTask); app.MapGet("/nullable", () => Task.CompletedTask); }}Note the API example at /actors/download that shows how to return a file like an MP4. Nice and simple. This sample also includes thoughtful validation code with FluentValidation extension methods like ctx.Request.Validate().Carter is opinionated but surprisingly flexible. You can use two different routing APIs, or clean and performant Endpoint routing:this.Get("/", (req, res) => res.WriteAsync("There's no place like 127.0.0.1")).RequireAuthorization();It even supports OpenAPI out of the box! Carter has an active Slack as well as Templates you can add to make your next File | New Project easier!dotnet new -i CarterTemplateThe following template packages will be installed: CarterTemplateSuccess: CarterTemplate::5.2.0 installed the following templates:Template Name Short Name Language Tags--------------- ---------- -------- ------------------------------Carter Template carter [C#] Carter/Carter Template/NancyFXThere's a lot of great innovation happening in the .NET open source space right now. Carter is just one cool example. Go check out Carter on GitHub, give them a Star, try it out and get involved in open source!Sponsor: YugabyteDB is a distributed SQL database designed for resilience and scale. It is 100% open source, PostgreSQL-compatible, enterprise-grade, and runs across all clouds. Sign up and get a free t-shirt© 2021 Scott Hanselman. All rights reserved.