Oh, hey everyone!

Hey folks! This blog has gone a little stagnant for a while. I’ve been busy, and have not been able to dedicate many of the working day hours to upkeep here.

But I hope to change that going forward. Within the past two years I have started up a YoueTube channel for some of my many hobbies (woodworking, metalworking, leatherworking, and just about ever other maker-thing you can think of, and some you have not) here at The New Janky Workshop. So, check that out (and subscribe!) if you’re into that sort of thing!

With that personal endeavour, I’ve also REALLY gotten into video editing and publishing (because yes, I need MOAR hobbies). So, I am going to try to semi-regularly post to my new channel, for things Microsoft, SharePointy, and other M365 topics (and also Azure, PowerShell, and other goodness). So, if you’re interested in that stuff (which, by the sake of you being on this post at all, likely means that you are). Please check it out: The SharePoint Yankee (and also subscribe there too!).

It’s brand new (so new, in fact, I just posted a quick short video today on it as my first one…). So, follow along, leave comments there or here on how you like the videos, what you’d like to see, and more, and I’ll get cracking on it.

Cheers!

Creating Runbooks in Azure and Calling Them from SharePoint Using Webhooks and Flow

AzureFlowSharePointAutomationRunbooks are a feature of Azure Automation that allow you to execute workflows from within Azure or remotely to automate processes.

To give an example, lets say you have a script that monitors an Azure service every 5 minutes to see if it is running or not. The script, will test and see the status of an Azure App Service. If it tests the site, and does not get the HTTP 200/OK message, then it triggers an alert, creates a ticket, and now someone has to go recycle the Azure App Service. If this can happen frequently, then it is something you would look to automate.

In comes the Azure Automation Runbook. You create a PowerShell script that is hosted in Azure (a Runbook), and when your script detects that the service is not responding, it makes a call out to a URL, and the URL runs the Runbook, which restarts the Azure App Service. The monitoring script then runs again, sees that the service is back up, and the appropriate steps are taken.

This might seem like a lot of extra work, but, if you are, say, connecting in through a VPN to manage an Azure environment, it can be quite time consuming just to restart a service.

However, we are not using that as our working example in this article. That was just to give you an idea of the kinds of things that can be done using Runbooks. In this article, we will be showing you how to create a Runbook, and call it from SharePoint, using Microsoft Flow. It will not be a real exciting example either, but, it will show you how to do all this, so you can do more on your own!

Prerequisites

This article assumes the following:

  • You have an Azure subscription. If you do not, you can get one here for free to play around
  • You have SharePoint Online

Creating an Azure Automation Account

Before we can create our Runbook, we need to create an Azure Automation Account. Login into the Azure Portal, click on New > Monitoring + Management > Automation

image

Configure the following settings for your Automation Account:

  • Name: What are you going to call it?
  • Subscription: Select the subscription to use
  • Resource Group: Either create a new one, or, use an existing.
  • Location: Which Azure region should this run in? I am using East US 2… since I’m in the East US.
  • Create Azure Run As account: This is not needed for our test, but, if you’re doing anything in Azure with your runbooks, you will want to configure this. For more information, visit: https://docs.microsoft.com/en-us/azure/automation/automation-offering-get-started#authentication-planning

image

Then press Create.

It’ll take a moment while this deploys…

image

Once done… access it either by the Automation Accounts blade on the left side, or, via the Notifications link Go to resource once its done deploying.

image

And you will be brought to the landing page for your Automation Account, AutomationTest

image

Creating an Azure Automation Runbook

Now that we have our Automation Account, we need to create our runbook. From within the Automation Account, click on Runbooks under Process Automation on the left hand side.

image

Then click Add a runbook at the top of the runbooks dashboard

image

Click on Quick Create / Create a new runbook

image

Fill in the details

  • Name: Check-Website
    Give your runbook a name
  • Type: PowerShell
    You can also choose Python 2, Graphical, PowerShell Workflow, and Graphical PowerShell Workflow
  • Description: Check the status of a website
    Enter in a description for the runbook

Then click on Create

image

And viola! Your runbook has been created!

image

It doesn’t do anything yet, so, we will need to add code. Click on Edit at the top of the dashboard.

Here is where we will type out, or paste in our PowerShell code for the runbook.

image

NOTE: Do not use Write-Host, there is no “host” per-say to write to. Instead, ensure all output is written using Write-Output

Let’s add the following code to test if Google is up and running…

Function OutputStatus($type,$status) {
    Write-Output "$type | $status";
}

Function Get-HTTPSStatus($url,$type) {
    $HTTPSStatus = Invoke-WebRequest $url -Method Get –UseBasicParsing
    if ($HTTPSStatus.StatusCode -eq "200") {
        return OutputStatus -type $type -status "Success"
    } else {
        return OutputStatus -type $type -status "Error"
    }
}

Get-HTTPSStatus "http://www.google.com" "Google Website"

image

Click on Save

image

Now lets test it…click on Test pane

image

Click on Start

image

You will see a message that it is being submitted

image

You can then see that it gets queued

image

And finally, we see the status and the output displayed

image

Pretty neat!

Now, lets say we want to add some parameters to our script, so we can specify the input… and not have it statically set as just “http://www.google.com” as the site, and “Google Website” as the description. Let’s update the code with some parameters…

To get back to your code, click on Edit PowerShell Runbook in the breadcrumb navigation at the top

image

Update our code with the parameters $Site and $Description, and then Save, and then go back on over to the Test pane

image

You can now see we have two fields for Site and Description under Parameters. Fill those out…

image

And run the script again…

image

Looks good! Now… we can do this all day from within Azure… but remember way back to the start of this article, I mentioned calling this from Microsoft Flow from within SharePoint? To do that… we’re going to need to make a change to our script, as well as create a webhook.

First, lets change our script. You know how we just added parameters? Well, when calling a webhook, we’re going to be making a REST call to a URL. We cannot pass in parameters like we just did to the script. That is good for running within Azure itself… in order to pass parameters to our runbook via a webhook… we need to change the parameters. We will be passing in an object called WebhookData (or whatever else you want to call it). Which will be the JSON data sent along with the REST call. So, let’s update our code to this:

image

We will then parse out the Site and Description name/value pairs from that and pass it into our script from the $WebhookData object.

The code for the above is here:

Param (
    [object]$WebhookData
)

Function OutputStatus($type,$status) {
    Write-Output "$type | $status";
}

function Get-HTTPStatus($url,$type) {
    $HTTPStatus = Invoke-WebRequest $url -Method Get –UseBasicParsing
    if ($HTTPStatus.StatusCode -eq "200") {
        return OutputStatus -type $type -status "Success"
    } else {
        return OutputStatus -type $type -status "Error"
    }
}

if ($WebhookData -ne $null) {
    Get-HTTPStatus $WebhookData.RequestHeader.Site $WebhookData.RequestHeader.Description
} else {
    Write-Error "No data received in webhook call."
}

We need to Publish it first before creating the webhook. Go back to the code view, and click on Publish

image

It will prompt you to confirm, click Yes, and it’ll be published.

image

Now that we’ve got that straightened out… let’s move on to creating our webhook.

Creating a Runbook Webhook

From our runbook Dashboard, click on Webhook at the top of the dashboard

image

Click on Webhook – Create a new webhook

image

Then give it a name, and an expiration date, and if it should be enabled or not…

image

Now… notice the big warning sign at the top of this screen…

image

See? Now… copy and paste that URL at the bottom, and save it somewhere. There is no way to get this URL once the webhook has been created.

image

Once you have done that, click OK

Then click on Parameters and run settings and then click OK there

image

Then click Create at the bottom of the form. Until you do that, you can still get the webhook URL…

Ok… now what? Let’s call it from PowerShell, since we need to do a POST to access it.

image

We can see in the Content section of the output, we are given a JobId of 4164eb1f-57ba-41c3-a7cb-2f556652e9ad

In our runbook, if we go to Jobs under Resources

image

We can see that a job successfully ran

image

Click on it, and we can see the status, and you will see the JobId matches what we got from the call from Invoke-WebRequest

image

You will see there were errors… because we didn’t actually send any data along with it. We just called it directly. But now that we have it… we can move on to SharePoint and Flow.

Creating a Flow to Call our Webhook from SharePoint

Now that we’ve gone through the meat an potatoes of this project… let’s look at linking at all together with SharePoint and Flow.

Log into your SharePoint Online tenant… and lets create a new list.

I’ve got a basic custom list called Flowtest

image

Now… once created, in the Modern interface… click on Flow > Create a flow

image

Click on See your flows at the bottom, because we’re going to create a brandy-new one…

image

Click on + Create from blank at the top of the page

image

Click on Search at the bottom of the next screen, and search for SharePoint created… we want to add a trigger for when a new item is created in our list.

image

Select SharePoint – When an item is created

Select your SharePoint Online site from the list, or, enter in the URL, then select the list… in this case, we’re using Flowtest

image

Then click + New step > Add an action

image

Click on HTTP under Connectors

image

Choose HTTP – HTTP

image

Then fill out the details…

  • Method: POST
  • Uri: The URL we copied when we created our webhook
  • Headers
    Site:
    http://www.google.com
    Description: Google’s Website (FROM SHAREPOINT!)

image

And then click on Save Flow

Also… don’t forget to give your flow a name Smile

image

You should now see your Flow

image

Now… open a new window, and go back to your list, and create a new item…

image

And if you check back on your flows…

image

You will see one succeeded!

Clicking on it will give you the breakdown of the flow run (which is one of the more awesome features of Flow… over IFTTT IMHO FWIW YK?)

image

Now… let’s go check Azure…

If we look at the jobs for our Runbook… we’ll see a new one in there…

image

Click on it, and then click on the output

image

image

It worked!

Now… let’s make this a bit more functional. Go back to your list settings in SharePoint

image

I’ve changed the Title field to URL, and added a field called Description as a single line of text.

image

Now, let’s go back to our Flow…

And edit the HTTP step

image

Edit the values for Site and Description, and then select the corresponding Site and Description values from the Dynamic Content list that pops up to the right. See what we’re doing here?

image

Let’s run our Flow… create a new list item, passing in a URL and Description…

image

and check the status…

image

It worked! It’s a day of miracles people! While this is not a really exciting example, it shows how to use Azure Runbooks and Webhooks, and how they can be accessed remotely to do a specific task.

What sort of cool things are you doing or have you done with Flow and Runbooks, if anything?

Resources and References

Connecting to SharePoint Online using the PnP PowerShell Library and NOT Having to Log In Every. Single. Time…

imageBefore you can do anything with the SharePoint Patterns & Practices PowerShell library, you need to first connect to SharePoint Online. Sounds pretty basic, right? You need to establish who you are, and maintain your access during your session with the site you are working with.

Now, the Documentation does show you how to do this:

image

Connect-PnPOnline –Url https://geoff365.sharepoint.com –Credentials (Get-Credential)

When you do this… you are prompted for credentials… Every. Single. Time.

image

This is good for production, however, if you are developing a script, you may run this tens or hundreds of times… and, it gets old pretty fast. So, here is what I do. In my script, I set variables for the username and password (alternatively, you could pass these as parameters, and pass them along using a batch file).

image

Then, I convert the password into a secure string, and create a PSCredential object with the username and secure password.

image

I can then connect to SharePoint Online using the Connect-PnPOnline command (as shown above), wrapped in a try/catch block, and not be prompted for credentials!

image

Here’s the full script:

#region Imports
Import-Module SharePointPnPPowerShellOnline -WarningAction SilentlyContinue
#endregion Imports

#region Variables
$Username = "admin@geoff365.onmicrosoft.com"
$Password = "ThisIsNotMyRealPassword!"
$SiteCollection = "https://geoff365.sharepoint.com/sites/powershellplayground"
#endregion Variables

#region Credentials
[SecureString]$SecurePass = ConvertTo-SecureString $Password -AsPlainText -Force
[System.Management.Automation.PSCredential]$PSCredentials = New-Object System.Management.Automation.PSCredential($Username, $SecurePass)
#endregion Credentials

#region ConnectPnPOnline
try {
    Connect-PnPOnline -Url $SiteCollection -Credentials $PSCredentials
    if (-not (Get-PnPContext)) {
        Write-Host "Error connecting to SharePoint Online, unable to establish context" -foregroundcolor black -backgroundcolor Red
        return
    }
} catch {
    Write-Host "Error connecting to SharePoint Online: $_.Exception.Message" -foregroundcolor black -backgroundcolor Red
    return
}
#endregion ConnectPnPOnline

I have a Public SharePoint Online site?

Yes. Yes you do. Well, if you have Office 365 and it is part of the license which you purchased. You didn’t have to do anything, you have a public facing (anyone on the internet can hit it just like a normal website) website.

Where is it?

It’s easy to find. Go into the SharePoint Online Admin Center

image

Select the first link on the left side navigation (the default) site collections

image

And in the listing on the right side of the page, it will be listed first under Public Website

image

The default URL will be http://yourtenantname-public.sharepoint.com.

And if you go there…You’ll see a nice SharePointy and Cloudy site…

image

 

Oh Cool! Now I can create a website like Ferrari in Office 365/SharePoint Online????

No. As of yet, SharePoint Online in Office 365 does not contain all of the super awesome Web Content Management and publishing controls that SharePoint 20XX on-premises does.

Oh…

Yep.

Ok, the public website is enough for my needs, can I create more than one?

No. Once you have one created, you cannot create another one. It will appear greyed out when attempting to create a new site collection.

image

Oh…

Yep.

Enabling Office on Demand in SharePoint Online

Office on Demand is a new feature in SharePoint Online on Office 365. Straight from the link, from the horses’ mouth so to speak:

Office on Demand is a feature that provides online access to full rich Office desktop applications, including Word, Excel, and PowerPoint, when you’re using a PC that doesn’t have the latest version of Office installed locally. Office on Demand is available to anyone who has an Office 365 subscription that includes the Office application suite. Office 365 subscriptions that include the Office applications let you install on up to five devices for use both online and offline. Office on Demand is a helpful option if you want to use your Office applications on an additional device or on a device that you don’t own, such as when you’re logged in as a guest using someone else’s computer.

This also works in environments where thin clients are used such as a Citrix or kiosk based setup where users cannot install software, and license management can become quite the hassle if multiple users are using the same server to do their work each day.

To enable or disable Office on Demand

Go into your SharePoint Online Admin Center

image

and select Settings from the left-side navigation

image

And then scroll down to the Office on Demand header to enable or disable the functionality.

image

SharePoint Online is…Helpful!

In many cases when working with SharePoint, you do not always know “what happens next” when do perform an operation in SharePoint. Microsoft is working to change that, especially with SharePoint Online and Office 365. Now, when performing actions, things have been re-worded, or additional information and confirmations have been added to the screens, since it is not just us SharePoint nerds managing deployments anymore with SharePoint Online.

Example: Deleting a Site Collection

image

See what they did there? Big red letters, stating that you can no longer access SharePoint anymore if you delete the root/main site collection in SharePoint online. It’s not wordy, and its in RED. You should hopefully not gloss over it. This will hopefully save some headaches and confusion.

How Do I Upgrade My Trial Office 365 Subscription to a Subscription Plan?

It is very cool, you get a 90 day trial for Office 365 to really test out the system and see what works, what doesn’t, and plan for your move to the service. 90 days, and you can even ask for extensions to make sure that this is the right solution for you. Not many services offer that even by a long shot. Microsoft wants you to make the right decision.

So, now that you’ve decided to go with Office 365, how can you keep all of your work and get properly licensed? It’s quite simple. Go to the Office 365 Admin Center

image

Select Purchase Services from the left-side navigation

image

You will see your current plan, listed as Currently in trial

image

Click the handy Buy now link…

image

And complete the process from there.

HOWEVER….. make sure you have your licensing trued up first. If you have licensed all 250 trial users you can have, and you only need 30… that first bill is going to be awfully painful.

Office Now Available on the iPad

image

No more do you need to use other word editors, excel-like programs, and slideshow apps, and more on your iPad. Microsoft announced Thursday 3/27 via the Office Blogs website that the Office Suite is now available for you iPad users (I am one too, so I am psyched about this!)

Your Office 365 subscription not only gets you the Office for iPad apps installed on up to 5 tablets, but also 5 copies across Office for your PCs and Macs.  With one subscription all of your devices are covered, so you can work the way you want.

This is awesome news.

Also to note from the article:

Office Mobile for iPhone and Android phones free

Just like Office Mobile for Windows Phone, we are making Office Mobile for iPhone and Android phones free for everyone. With Office Mobile, you have the ability to view and edit your Office content on the go.  Office Mobile is available in the App Store and Google Play.

Even more awesome news. I’m an Android user.

You can expect a tablet like interface to the familiar interface you are already familiar with in office, now across all of your devices. Go on, be productive.

Quote sources: http://blogs.office.com/2014/03/27/announcing-the-office-you-love-now-on-the-ipad/

Office 365, SharePoint Online and SharePoint 2013 On-Premises Feature Matrix

Andrew Connell released an updated Excel Spreadsheet today, which shows the (filterable) differences between Office 365 plans, SharePoint Online, and SharePoint 2013 on-premises. This is a great resource to keep handy, and keep you honest 🙂

image 

Read more at http://www.andrewconnell.com/blog/office-365-sharepoint-online-and-sharepoint-2013-on-prem-feature-matrix-updated#RLqeQWPtJtHiWVwi.99

Boston Office 365 Users Group coming in May!

With Microsoft’s focus on Office 365, and it being the largest product in history for them (surpassing SharePoint on-premises licensing), a few great minds here in the Boston area started talking a few months ago, about creating an Office 365 users group (not just covering SharePoint Online, but Lync, Exchange, Yammer, and whatever else gets tossed out onto the buffet line that is Office 365!).

Well, we have done just that, and are having our inaugural meeting on Thursday, May 22nd, at the Microsoft New England Research and Development Center (N.E.R.D.) from 6pm to 8pm. We will have Chris Bortlik, a Microsoft Office 365 Technology Specialist, kicking us off with his session “Introduction to Office 365”. See below for an abstract and bio for the session.

We will be having regular monthly meetings on the third Thursday of each month, so stay tuned for more as we build out our schedule of great speakers and topics going forward!

Our website is up (work in progress), but please sign up for our mailing list to be notified about future meetings and information about the group! http://www.bostono365usergroup.com/

Abstract

Office 365 is the fastest growing product in Microsoft’s history. Come to this session to learn what Office 365 is and how your organization can get started leveraging it today. During this talk we will cover the following topics:

  • Office 365 functional overview, focusing on Exchange Online, SharePoint Online, Yammer, Lync Online, Office Online, mobile applications, and Office 365 ProPlus
  • Office 365 architecture fundamentals, including identity management, authentication options, browser, and device requirements
  • Office 365 admin center
  • Office 365 service descriptions
  • Staying up to date with Office 365 service announcements and updates
  • Office 365 FastTrack deployment model
  • Key Office 365 training links and resources

Bio

Chris Bortlik works at Microsoft as an Office 365 technology architect. He works with Enterprise customers and partners in the Northeast in a technical role focused on SharePoint, Office, Exchange, Lync, Yammer, and other parts of Office 365. Chris is an “Insider” within Microsoft and works closely with the Office 365 product team. He holds the SharePoint MCITP and MCTS certifications. Chris speaks frequently at Microsoft events (including the SharePoint Conference); is a contributing author of the "Essential SharePoint 2010" book; and a coauthor of the “Essential SharePoint 2013” book. Chris also blogs regularly on TechNet: http://blogs.technet.com/cbortlik  Prior to joining Microsoft in 2008, Chris was a customer for 14 years working in technical IT architect, development, and management roles – primarily leading .NET and SharePoint related projects. You can follow Chris on Twitter @cbortlik