>> .NET Interactive Notebooks are a new thing to me.
Tune in to this episode of
MVP Edition of Data Exposed to learn more.
[MUSIC]
Hi. I'm Anna Hoffman and welcome to
this episode of Data Exposed, MVP Edition.
Today, I'm joined by Rob.
Rob, why don't you tell us a little bit about yourself?
>> Hi, my name is Rob Sewell.
I'm lucky enough to be an MVP.
I'm a bloke that likes to spend his time either deep
in code solving problems or stood on a stage doing presentations.
>> Well, we're happy to have you here.
Today, we're going to talk about PowerShell,
and we're also going to talk about Notebooks
and something that I hadn't even heard
of it until you brought this idea for this video.
Why don't you tell us a little bit about why you
like Notebooks and how it relates to PowerShell.
>> Hopefully, everybody knows about Notebooks nowadays.
The number one reason why I think we should use
Notebooks is this precise problem.
If we've got an editor of some sort, a client tool,
and we connect to a database and we run a query of some sort,
we've got our results, and that's brilliant.
But if this was three o'clock in
the morning and we were resolving an incident,
we might have numerous queries open.
Maybe at some point, we'd get
distracted and actually close one of these tabs.
The biggest problem when we close this tab, results are gone.
They are absolutely no use to us when we do a wash-up
meeting to refer to later in the incident.
This is why I love Notebooks,
because Notebooks give us executable code
and they get to save the results.
Quite often, when I have an incident or I'm asked a question,
"We've got a problem with
this," perhaps the first thing I'll do is open a Notebook.
We make that a bit smaller, then I'll say, "Well,
okay, here's some text about what's happening.
Today [inaudible] this, something happened."
Maybe the first thing I want to do is check
my instances are up and running.
Are you going to work?
Yes, there we go.
Look. Have I got some SQL?
Yes, I've got some SQL instances, they're up and running.
Perhaps the other thing I want to check is my databases there.
Does it exist? Yes, there we go. It exists.
I could carry on going through this,
doing my troubleshooting, seeing what is happening.
The beauty of it is if I just save
this and we'll save it in C Temp,
don't save your Incident Notebooks in C Temp,
here we go, this is what happens at three o'clock in the morning.
>> Third time's the charm.
>> You never know.
Don't save it in C Temp.
But now, I've got my incident.
If I close that and it goes,
then no worries because I can just type c/temp,
look at this, did it, go to my incident,
there is the code that I wrote,
the documentation I wrote, and all the results.
So that is in 30 seconds
just why I think we should use Notebooks, number 1 reason.
>> Awesome. Thanks, Robin.
I also think Notebooks are super powerful,
but now I'm looking at your screen
and I'm seeing something I've never seen before.
You're using a .NET PowerShell kernel.
Can you tell me what is that and how did you get that set up?
>> How do we get that set up?
That brings me to something even more cool.
Let's have a look at this.
What I'm going to do is show you GitHub.
In GitHub, we've got a Notebook.
You can actually display
your Notebooks within GitHub, they render here.
You can put them in gists.
When my friends ask me
questions about how do I do this thing with PowerShell,
I'll create a Notebook
because they can look at it quickly
in a browser and see what it is that I'm saying.
Then they could take it down and run it on
their own machine and actually
play with it and change things and make it work.
How do we get a .NET Interactive?
Click on this link, it's going to take you to this blog post by
Maria from the .NET team
and there are a number of steps to follow there.
I'm not going to go through them
because you're just going to have to follow
them. That's how we get them.
Now, I'm using Azure Data Studio to show the editing experience.
There are other ways of doing it.
To be able to edit .NET Interactive Notebooks in Azure Data Studio,
you just need to do one little thing.
You need to have the latest Azure Data Studio, stable or insiders,
and then click on the cog and then "Settings".
If you search here for "kernel",
it's going to come up with these two options.
By default, this will not be ticked,
so you'll need to tick this one.
The second thing you need to do,
press F1, and if we type "Notebook",
we get the option to create a new Notebook.
You can see, we think, "Great,
we'll just change the kernel to .NET."
There's a little flip here.
Change the kernel to Spark or one of the other ones,
and then [inaudible]
Now, we can pick the .NET Powershell which is absolutely brilliant.
Now, this is true .NET Core-compatible PowerShell.
It's going to run PowerShell 7 on
whatever operating system that you choose to run it on,
it's going to have the same experience.
>> Awesome. We've seen how to set these up,
this new thing of .NET Notebooks that I hadn't seen before.
Looks like multiple language are supported there.
Now, if we bring it back in,
how does this relate to SQL?
I mean, obviously, you can do a lot with SQL and with PowerShell
and with .NET and with Azure Data Studio,
but can you bring it all together for us?
>> Let me show you.
What I would do is make use of my GitHub repository.
For example, we've talked about how
we could use this for incident response.
We talked about maybe demonstrating things with your friends,
maybe your open source project, whatever else.
What about repeatable tasks that we need to do again and again?
We get asked, "Who has got permissions to this database,
to this instance, to this whatever?"
It doesn't matter what's behind there;
we can give this Notebook to
a normal user with the right permissions
and then we could run it,
and it's going to do a whole lot of magic and provide us with,
on another screen, everybody's favorite way of displaying data,
Excel, with nice color-coded output ready for users.
All I've done there is run some PowerShell code
that's been written to bring out all of
the permissions for an instance color-coded
ready for a business users to make use of.
>> Wow, that's really cool.
I have never seen anything like that before.
Are you going to share out
this GitHub so that our viewers can play around?
Seems like you got a lot of stuff in here.
>> Everything is here.
If we come back from this page,
this is my Jupyter Notebook repository.
Within that, you can see SQL DBA with a beard. Can you guess why?
>> That's you.
>> That's me. It's Jupyter Notebooks.
Then in this Notebooks photo,
we've got .NET Notebooks and we've got what I call
not .NET Notebooks, which is the typical, before,
.NET Azure Data Studio Notebooks.
Everything is there. Please use them,
take them, make them better,
and tell me what you do.
>> Awesome. This has been really cool.
I've seen a lot of new stuff today.
I hope the viewers have as well.
I think they probably have.
We'll put a link to Rob's GitHub in the description.
Thanks so much for being here with us today, Rob.
It's been a great time.
>> Thank you so much for having me.
I absolutely love sharing this
and to be able to teach you something new
after all the things you [inaudible] brilliant.
>> Awesome. Thanks for our viewers for watching this video.
If you like this video,
please like this video,
subscribe to our channel, and tune
into our next episode of Data Exposed.
[MUSIC]