Building SharePoint 2016 development environment – Part 15 – Configuring Workflow


A few years ago I wrote “Build your SharePoint 2013 development machine on Windows Server 2012” series, I mainly work in the cloud now, but as the blogs was so popular, I thought I would create a new series for the newer version of SharePoint.

You can access other parts of this post below.

The configuration of the Workflow Manager for SharePoint 2016 is the same as it was for SharePoint 2013. Not only do you need to install the separate Workflow Manager components, once installed SharePoint designer will show SharePoint 2013 Workflow in a dropdown when deciding which platform to build the workflow on.

We will be installing Workflow Manager 1.0 CU3. Although my instructions add all this to the SharePoint Machine, the reason why Microsoft have made the Workflow manager separate is for scaling. There is no need for this to be installed on the SharePoint box. You could create another Windows Server 2012 R2 and add that to the domain and run the Workflow manager on that. There are probably a few more steps required in configuring. Here is a full walkthrough provided by Microsoft Technet https://gallery.technet.microsoft.com/SharePoint-2016-Workflow-acd5ba2a if you wish to delve in deeper.

Installing SharePoint Designer 2013

Wait! SharePoint Designer 2013? Yes.

There is no SharePoint Designer 2016, there is no plan to release one either. Microsoft have stated that they will support SPD 2013 with SharePoint 2016. We are installing SharePoint Designer here because I can use it to prove if you have correctly configured Workflow Manager with SharePoint 2016 correctly.

SharePoint Designer 2013 is a free tool from Microsoft.

  1. Download SharePoint Designer 2013 32bit from the Microsoft Site.
    https://www.microsoft.com/en-GB/download/details.aspx?id=35491
  2. Once downloaded run the file sharepointdesigner_32bit.exe
  3. Accept the License terms and click Continue.
  4. Click Install Now, (Unless you wish to customise and change file location, user information etc)
  5. Once installed, I’d recommend performing a Windows Update. From the Start Menu, type Windows Update, open the application and run any updates required. Reboot if necessary.

Check to see Workflow settings in SharePoint Designer

  1. From the start menu, type SPD and open SharePoint Designer 2013.
  2. Once it has loaded up, click Open Site
  3. Type the URL https://dev.cfcode2016.com click Open
  4. If prompted, enter your credentials
    User: cfcode2016\SP_SetupPassword: Pa55w0rd
  5. From the Navigation menu, select Workflows

  6. On the ribbon menu, select List Workflows > Documents

  7. In the Create List Workflow dialog, at the bottom you will see a dropdown box for Choose the platform to build your workflow on. Only SharePoint 2010 will be listed.

  8. When we come back to this later, we will see SharePoint 2013 Workflow. Close SharePoint Designer for now.

Configuring Workflow Manger accounts

The Workflow Manager will run under new accounts that we haven’t created yet.

  1. On the Domain Controller machine, in the start menu, type Active Directory Users and Computers and open it.
  2. Expand the tree in the left hand pane to see the Managed Service Accounts OU. Select the Managed Service Accounts OU.
  3. Right click in the right hand pane, and select New > User.
  4. Create a user called SP_Workflow. Set the full name and log on name to SP_Workflow. Click Next.
  5. In the password dialog screen, enter the following and click Next
    1. Password and Confirm Password as: Pa55w0rd
    2. Untick User must change password at next logon.
    3. Leave User cannot change password as unticked
    4. Tick Password never expires
    5. Leave Account is disabled as unticked
    6. Click Next. Then click Finished.

Setting up SQL with the correct Security Accounts

  1. On the SharePoint Machine, from the start menu, type SQL Server Management Studio and open up the application
  2. In SQL Server click Connect. (This should be to SQL2016 database instance).
  3. In the left hand menu expand Security. Right click Logins. And select New Login…
  4. In the Login – New dialog box, click the Search button.
  5. Click the Locations button and select Entire Directory.
  6. Type SP_Workflow in the Enter the object name to select, and click Check Names. This will resolve the name. Click OK.
  7. In the left hand panel select Server Roles.
  8. Tick both securityadmin and dbcreator then click OK.
  9. Close down SQL Server Management Studio

Giving SP_Workflow administrative rights on the SharePoint machine.

  1. From the start menu, type Edit local users and groups and open up the application.
  2. In the left hand panel, select Groups
  3. In the right hand pane, double click Administrators
  4. On the Administrators Properties dialog box, click Add
  5. Type SP_Workflow in the Enter the object name to select, and click Check Names. This will resolve the name. Click OK.
  6. Close Edit local users and groups.

Install the Microsoft Web Platform Installer 5.0

  1. Go to the URL https://www.microsoft.com/web/downloads/platform.aspx and download the latest Microsoft Web Platform Installer
  2. Once downloaded run the file wpilauncher.exe
  3. If like my machine it is already on there, it will just open the Web Platform Installer 5.0 else it will install it for you. Accept the License Agreement and click Install. Then click Finish when complete.

Install Workflow manager

  1. From the Start menu, type Web Platform Installer and open the application

  2. In the search box in the top right of the screen, type Workflow Manager and press Enter.
  3. Click Add on the Workflow manager 1.0 Refresh (CU2) and click Install at the bottom.

  4. Click I Accept

  5. When complete, click Continue.

  6. Click Finish.

  7. Close the Workflow Manger Configuration Wizard that has popped up.

Apply Cumulative Update 3.0 for Workflow Manager 1.0

  1. Close and re-open the Web Platform Installer 5.0 we are going to install the CU 3. (You need to close and re-open otherwise the installer thinks Workflow Manger 1.0 hasn’t been installed)
  2. Type Workflow Manger and press Enter in the top right search box.
  3. Click Add for Workflow Manager 1.0 Cumulative Update 3, then click Install at the bottom.
  4. Click I Accept. Once installed click Finish. Click Exit on the Web Platform Installer.

Configure the Workflow manager

  1. From the start menu, type Workflow Manager Configuration
  2. Click on Configure Workflow Manger with Custom Settings
  3. In the Configure Farm Management Database,
    1. Enter your SQL Server Instance: sql2016.cfcode2016.com
    2. Tick Use the above SQL Server Instance and Settings for all Databases
    3. Enter the Database Name: WF_ManagementDB
    4. Click Test Connection button to ensure all working OK.
  4. In the Configure Instance Management Database
    1. Enter the Database Name: WF_InstanceManagementDB
    2. Click Test Connection button to ensure all working OK.
  5. In the Configure Resource Management Database
    1. Enter the Database Name: WF_ResourceManagementDB
    2. Click Test Connection button to ensure all working OK.
  6. In the Configure Service Account
    1. Enter the User ID: CFCODE2016\SP_Workflow
    2. Enter the Password: Pa55w0rd
  7. In Configure Certificates
    1. Leave Auto-generate ticked
    2. Certificate Generation Key: Pa55w0rd
    3. Confirm Certificate Generation Key: Pa55w0rd
  8. In Configure Ports leave default port numbers
    1. https: 12290
    2. http: 12291
    3. Leave Allow Workflow management over HTTP on this Computer unticked
    4. Leave Enable firewall rules on this compute unticked (As we have disabled our firewall)
  9. In Configure Admin Group
    1. Leave BUILTIN\Administrators
  10. Click Next button
  11. On the Service Bus Configuration page, please provide the following
  12. In Configure Farm Management Database
    1. Enter the Database Name: Sb_ManagementDB
    2. Click Test Connection button to ensure all working OK
  13. In Configure Gateway Database
    1. Enter the Database Name: Sb_GatewayDB
    2. Click Test Connection button to ensure all working OK
  14. In Configure Message Container Database
    1. Enter the Database Name: Sb_MessageContainerDB
    2. Click Test Connection button to ensure all working OK
  15. In Configure Service Account
    1. Tick Use the same service account credentials as provided for Workflow Manager
  16. In Configure Certificate
    1. Tick Auto-generate
    2. Tick Use the same certificate generation key as provided for Workflow Manager
  17. In Configure Ports
    1. https: 9355
    2. tcp: 9354
    3. Message Broker Port: 9356
    4. Internal communication Port Range: 9000
    5. Untick Enable firewall rules on this computer (as we have disabled out firewall)
  18. In Configure Admin Group
    1. Leave BUILTIN\Administrators
  19. Click Next button
  20. On the Summary page, click the Tick button at the bottom right of the screen to start installation.
  21. The configuration process can take up to 10 minutes to complete. Once complete, you will see a success pag

Add Workflow Manager Certificate into SharePoint

  1. In Start Menu, type IIS and open Internet Information Services (IIS) Manager
  2. Expand your server name, and Sites. You will now see a site called Workflow Management Site

  3. Click on Workflow Management Site, then on the right hand pane, click Bindings
  4. Select https and click edit.

  5. On the Edit Site Binding, under SSL certificate you will see a Certificate that matches your Server Name. Click the View button.

  6. On the Certificate dialog, click on the Details tab.
  7. Then click Copy to File button.
  8. On the Certificate Export Wizard click Next.
  9. On the Export Private Key page, select No, do not export the private key, click Next

  10. On Export File Format page, select DER encoded binary X.509 (.CER) Click Next
  11. On File to Export page, select a path and filename on your machine. Click Next.

  12. Click Finish. You will receive a successful export message.

Import Certificate into SharePoint Trust

  1. Open SharePoint 2016 central administration
  2. Under Security > General Security click Manage Trust
  3. Click the New button in the ribbon.
  4. On the Establish Trust Relationship page, enter following information:
    1. Name: Workflow Manager
    2. Root Authority Certificate: <Select your file from previous steps>
  5. Click OK.
  6. You will see your certificate in the store.

Register Workflow Service Proxy

  1. In Start Menu, type SharePoint 2016 management Shell (run as administrator) and open the application
  2. In the console type:

Verify the Configuration of Workflow Manager.

  1. Open SharePoint 2016 central administration
  2. Click Application Management
    > Manage services applications
  3. At the bottom of the Manage Services Applications page, there will be Workflow Service Application Proxy

  4. If you click on Workflow Service Application Proxy it will take you a status page that will show you that workflow is now connected.

Check to see Workflow Settings are working in SharePoint Designer

  1. From the start menu, type SharePoint Designer and open the application
  2. Once SharePoint designer has opened, click Open Site.
  3. Type the URL https://dev.cfcode2016.com click Open.
  4. If prompted, enter your credentials
    User: CFCode2016\SP_Setup
    Password: Pa55w0rd
  5. From the Navigation menu, select Workflows
  6. On the ribbon menu, select List Workflow > Documents
  7. In the Create List Workflow dialog, at the bottom you will see a dropdown box for Choose the platform to build your workflow on. Both SharePoint 2010 and SharePoint 2013 should be listed if the Workflow is set up correctly.

We are almost at the end. You SharePoint farm is configured to give you a good start as a development machine. Only thing left now is actual development tools. That will be covered in my final post of the series. Shut down your machines, take a checkpoint. (We will remove checkpoints in the last post)

Building SharePoint 2016 development environment – Part 12 – Configuring Hosting Apps and HNSC


A few years ago I wrote “Build your SharePoint 2013 development machine on Windows Server 2012” series, I mainly work in the cloud now, but as the blogs was so popular, I thought I would create a new series for the newer version of SharePoint.

You can access other parts of this post below.

Before I create the App Management Service, I’m going to create a separate Domain for the Apps. By creating a separate domain, it helps you write apps that won’t allow cross-site scripting between apps and SharePoint site.

Configuring Hosting Apps

First we need to configure DNS

  1. Go to you Domain Controller and from the Start Menu type DNS, and open the application.
  2. In the Left Hand panel, right click Forward Lookup Zones and select New Zone… Click Next
  3. Keep the Primary zone selected and Store the zone in Active Directory ticked.
    Click Next
  4. Leave the option To all DNS servers running on domain controllers in this domain: cfcode2016.com. Click Next
  5. Here you enter the domain name, type cfapps.com. Click Next
  6. Leave the top option selected and click Next
  7. Click Finish. You will see your new domain showing in the Forward Lookup Zones in DNS.
  8. Now right click on cfapps.com and select New Alias (CNAME) …
  9. Type * for Name
  10. Set the FQDN of the server that hosts the SharePoint sites, CFSP2016.cfcode2016.com in my case. Click OK.

    If you are using more than one server, you should be pointing to the DNS record of the web server in here. This is either the DNS A record for the web server, or the DNS record of the primary cluster address for NLB environments.

    Now if you open a command window and type in nslookup something.cfapps.com it will resolve to your SharePoint server.

Configuring SharePoint 2016 for Hosting Apps

I would recommend to copy the following powershell script and running it as a ps1 file (CreateAppService.ps1 from my one drive). Change the Change any of the variables to match your environments.

  1. On the SharePoint box, logged in as SP_Setup, from the Start Menu, type SharePoint 2016 Management Shell.
  2. Run the Script
  3. To verify the script configured SharePoint 2016 correctly open Central Administration
    1. Under Application Management click Manage Service Application.
    2. You should now have two new service application created
      1. App Management Service Application
      2. Subscription Settings Service Application
    3. Now Navigate to System Settings by clicking the link on the left menu
    4. Under Servers
      click the link Manage Services on Server.
    5. Check that the following services have started
      1. App Management Service
      2. Microsoft SharePoint Foundation Subscription Setting Service
    6. On the left hand menu, click on Apps
    7. Under App Management, click the link Configure App URLs
    8. Verify that:
      1. App Domain: cfapps.com
      2. App Prefix: app

Configuring SharePoint Server 2013 for Host-Named Site Collection and create Initial Site Collections.

Here we are going to create Host Named Site Collection (HNSC) for testing and hosting our apps. Microsoft recommends this because the Office 365 environment uses host-named site collections, new features are optimized for these site collections and they are expected to be more reliable. More can be found out directly from the technet article: http://technet.microsoft.com/en-us/library/cc424952.aspx . The only sites within your environment you should use Path Based Site Collections (PBSC) are Search Center and MySites. HNSC aren’t really needed for Search Center. The only way you can create HNSC is via powershell. So this is what we are going to do.

Register SP_Content

  1. Open SharePoint Central Administration
  2. Select Security > Configure managed Accounts.
  3. Click Register Managed Account
  4. Type Username as cfcode2016\SP_Content and the password as Pa55w0rd. Then click OK.

Create a new Web Application

Open up a PowerShell window and put the following: (change the port number if you wish) (CreateHNSC.ps1)

Configuring the Alternative Access Mapping

  • From the Start Menu
    open SharePoint 2016 Central Administration, this ensures it runs as Administrator.
  • Click Application Management, then under Web applications,
    click Configure alternative mappings.
  • On the right hand side of the screen, Change the Alternate Access Mapping Collection to point to SharePoint HNSC Web Application.
  • Click the internal URL for https://cfsp2016:11111 so that you can edit it. Change the URL protocol, host to https://hnsc.cfcode2016.com
  • Click OK.
  • Back on the Alternate Access Mapping Screen, click Add Internal URLs and add a new Internal URL for each of the following listed below. Screenshot below

Add certificates to IIS

  • In Start type IIS and open IIS Manager
  • Navigate to SharePoint HNSC Web Application and then on the right hand panel, click Bindings…
  • On the Bindings dialog, click Add…
  • In the Add Site Binding page, select https from the Type dropdown, leave the IP address as All Unassigned, the Port should say 443. Enter the Host name as hnsc.cfcode2016.com,
    and tick Require Server Name Indication then select your certificate you created earlier. Click OK
  • Add the binding for host names dev.cfcode2016.com and intranet.cfcode2016.com, ensure the Type is https, you have ticked Require Server Name Indication and you have selected your certificate.

Creating the Top level Site

Because the top-level site is an HNSC is not going to be used by anyone in the site. Therefore, this PowerShell script will create a blank site. (CreateHNSC.ps1)

  1. In PowerShell run the following script:

Site Collections

Here we are going to create a TeamSite called Intranet.cfcode2016.com and a developer site called dev.cfcode2016.com. Please note you can only create, debug and test apps using a developer site. You could type the PowerShell into notepad, save the file as PS1 and run it from SharePoint 2016 Management Shell, instead of typing each row directly. We are first going to create 2 databases, one for each Site collection. This is good practice for backups and restore purposes.

  1. From the Start Menu, type SharePoint 2016 Management Shell, and open the application. (CreateHNSC.ps1)
  2. Type

To verify that the host-name site collections are created:

  1. Open up SharePoint 2016 Central Administration
  2. Under Application Management click View all Site Collections
  3. Ensure the Web Application is pointing to the HNSC web and you should see the two site collections plus the root site.
  4. By clicking on the different site collections, you will also see that the Database Name is assigned correctly to the correct database as set up in our PowerShell script.
  5. You can also navigate in a browser to https://dev.cfcode2016.com or https://intranet.cfcode2016.com. Notice that the SSL certificate is valid.

Configuring SSL for Apps

As our App domain is on a different domain to our SharePoint domain, we should create a different SSL certificate for it.

  • Ensure you are on the SharePoint box with a Domain Admin Account. (cfcode2016\Administrator)
  • We have already configured the Certificate Authority earlier on the Domain Controller. Here we are going to request the certificate using Internet Information Services on the SharePoint Server. From the Start Menu, type IIS and open Internet Information Services (IIS) Manager
  • Once IIS opens, click on the Server Name. (CFSP2016) You will be prompted with a dialog asking to get started with Microsoft Web Platform, click do not show this message and then click No.
  • From the IIS section, double click Server Certificates

  • From the right hand side of the screen, click Create Domain Certificate

  • Complete the form for the Domain Certificate as follows (Change to match your environment if not following exactly along)
    • Common Name : *.cfapps.com
    • Organisation: CF Code
    • Organizational Unit: Computers
    • City/Locality: London
    • State/Province: London
    • Country/Region: GB


  • Click Next
  • On the Online Certification Authority enter the common name you gave your Authority Name\Server Name. (For example mine is MY-CA\CFAD.cfcode2016.com), You can also use the select button if you have configured everything correctly. You can put anything in the friendly name box, ensure it is different from your other certificate friendly name, and easy identifiable as the Apps certificate. Click Finish.

  • You should now see the certificate in the Server certificates window.

  • If there were other servers in your farm, you would need to export the .pfx file so that it can be imported into the other servers.

Configure SharePoint for Apps

We need to configure our SharePoint and IIS to use a different certificate for Apps, and also our Web Application needs to know to use our App Domain.

  1. Sign back into the SharePoint machine as SP_Setup.
  2. Run as administrator, SharePoint 2016 Management Shell
  3. Run the following PowerShell Script

  4. Next we need run the following command:
  5. In Start type IIS and open IIS Manager
  • Navigate to SharePoint HNSC Web Application and then on the right hand panel, click Bindings…
  • On the Bindings dialog, select the one without the Host Name on Port 11111 and click Edit
  • Change the Port to 443, and select the SSL Certificate as your App Certificate.
  • Click OK.


Add Apps to your Intranet Zone.

To prevent getting prompted for your login, configure the intranet zone in IE.

  • Open up Internet explorer
  • Click on the cog symbol, and select Intranet Options
  • Select the Security tab, and then click on Local Intranet. Then click on the Sites button.
  • On the Local intranet dialog, click the Advanced button.
  • Type *.cfapps.com and click Add. (You might need to untick Require server verification (https) for all sites in this zone )
  • Then click Close, OK, and OK

Checking that Apps are new set up for your farm

  1. Open up your intranet site https://intranet.cfcode2016.com
  2. At the top right of the screen click the cog icon.
  3. From the drop down, click Add an app
  4. On the App page, in the quick launch menu area, click on SharePoint Store
  5. If you have connected up correctly you will now see Apps that you can download from the SharePoint store.
  6. Pick a free one to install. I’m selecting Bright Banner. (Have no idea if it’s any good, so not endorsing, just using for testing purposes)
  7. Click Add it.
  8. Confirm that you wish to add the app. Click Continue
  9. A page will state that you have just go this app for everyone in your organization. Click Return to Site
  10. A prompt will appear, asking if you trust the application. Click Trust It.
  11. After a moment you will be returned to your Site Contents. You will also note that your app that you downloaded is currently being added to your site. Once complete the adding text will disappear.

  12. Click on the App. It will load. Take note of the URL. It is being called from the domain you created earlier cfapps.com. Congratulations you have got Apps working!

So glad I finally got Apps certificates to work. Took me a couple of attempts. Thank you to Anupam Shrivastava and his blog post http://akforsharepoint.blogspot.co.uk/2015/05/sharepoint-hosted-apps-in-aam-or-host.html for helping finally cracking it.

I recommend shutting down and taking checkpoints again.

Building SharePoint 2016 development environment – Part 11 – Configuring Services


A few years ago I wrote “Build your SharePoint 2013 development machine on Windows Server 2012” series, I mainly work in the cloud now, but as the blogs was so popular, I thought I would create a new series for the newer version of SharePoint.

You can access other parts of this post below.

In this blog I will talk about setting up your environment, by setting up the services. I will be doing majority of this using PowerShell scripts. The scripts will be within this post, but at the end there is a link to my one drive that will contain the PowerShell scripts.

Setting up Services

At the end of the last blog post we Installed SharePoint 2016, however we told the wizard that we would configure the services ourselves. These steps will configure the following services:

  • Managed Metadata Service
  • Word Automation Service
  • BDC
  • Secure Store
  • Usage and Health Data Collection Service
  • Create Machine Translation Service

We are doing this as a script so that Application and Database names are friendly names instead of GUIDs. Before you run the script, on your SharePoint machine, please make sure there is a folder at D:\SPLogs\ULS. This is the folder required for Usage and Health Data Collection Service.

When you run the script there will be a prompt for the SP_Services password. Pa55w0rd. Lastly ensure that your PowerShell window is running in Administrator mode. (CreateSPServices.ps1)

Once this code is done, if you head to Central Administration > Application Management then under Service Applications click Manage Service Applications you will see all your new services created.

Also now note, if you open explorer and navigate to D\:SPLogs\ULS you will see your SharePoint logs being displayed there instead of the default location of c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\Logs


Configuring Created Services – Secure Store Service Application

Now we have created the services, they all should be working apart from the Secure Store. It requires a little configuration before it can be used.

  1. Open SharePoint 2016 Central Administration (run
    as administrator) and navigate to Application Management > Manage service applications (Under Service Applications)
  2. Click on Secure Store Service Application. You will see an error message saying you must generate a new key for this Secure Store Service Application. Click on Generate New Key in the ribbon.
  3. On the dialog that appears, put in a Pass Phrase and Confirm Pass Phase. I’m using Pa55w0rd. Click OK.

Creating a Search Service Application

This could also be configured using a PowerShell script, but at times I prefer to do point and click.

  • Open the Manage Service Applications screen again.
  • From the ribbon, click on New and select Search Service Application.
  • This will show you a dialog called Create New Search Service Application. Enter the following information:
    • Service Application Name: Search Service Application
    • Search Service Application Type: Leave unticked. (Out of scope of this blog post for hybrid)
    • Search Service Account: Click on Register new managed account.
      • Service Account UserName : CFCODE2016\SP_Search
      • Service Account Password: Pa55w0rd
      • Click OK.
    • Search Service Account: CFCODE2016\SP_Search
    • Application Pool for Search Admin Web Service: Use existing application pool – Default SharePoint Service App Pool
    • Application Pool for Search Query: Use existing application pool – Default SharePoint Service App Pool
  • Click OK
  • You get messages displayed to you as the service is created.
  • You will get a success message when completed.

We will configure it further in a later blog post where we create the Enterprise Search center. You might want to shut down your machines and take a checkpoint before continuing.

Onedrive link to PowerShell scripts

Deploying an Azure Website using PowerShell


Every developer learns that F5 is their deployment friend, but when it comes to deploying to live/production environments it is not an option. So how can you website code be deployed into Azure?

Let’s start of by creating a website in Visual Studio.

  • Open Visual Studio and Click New Project… from the welcome window.
  • From the new project dialog, select ASP.NET web Application and Click OK.

  • On the New ASP.NET Project dialog, select the template you wish to use. I’m using an MVC template, with No Authentication.

  • At this point it will ask you to configure your Microsoft Azure Website. Fill in the details and click OK. (I know this creates the site for you in Azure, we will delete this later.)

Once created you will have a Website, just underneath the solution we have PowerShell files that Visual Studio uses to deploy the website to Azure. It is these PowerShell files and configuration that we will use ourselves.

First we need to package up the website. You can do this by right clicking on the project in Visual Studio and click Publish.

The Publish web dialog that appears will be set up for direct publishing to Azure, we need to change the Publish method to Web Deploy Package, and then give a Package Location.

Click Next > and on the next page of the wizard, ensure you Configuration is set to Release. Note: if there is a web job related to this, then do not click Exclude files from the App_Data folder as this is where the webjobs get compiled to.

Click Next > then Publish.

If you open the folder where you published your website files to you will find a collection of files. The only file you need from here is the zip file, so delete the rest, they are for IIS deployment.

From your Visual Studio project copy over your configuration, Publish-WebApplicationWebsite.ps1 and AzureWebSitePublishModule.psm1 file. These are all the files required to give to your administrator to deploy to Azure, with the next set of instructions with the heading “Deploying to Azure”.

Just before we continue to the next step, go to you azure tenant and delete the website that Visual Studio created, that way you will be doing everything via PowerShell.

Deploying to Azure.

To deploy to Azure you need to ensure you have Azure PowerShell installed on your machine – see my blog Installing Azure PowerShell if you need instructions how to. You will also need to know how to connect to you Azure Subscription via PowerShell. The steps below will show the basic commands but if you have multiple subscriptions you should read my blog Handling Azure PowerShell with multiple Azure Subscription first to ensure you don’t deploy to the wrong subscription.

  • Open the Configurations folder and edit the .json file.
  • Change the website Name and Location to match where you want this deployed and the name you wish to give it.

{

    "environmentSettings": {

        "webSite": {

            "name": "CFWebSiteDemo-Dev",

            "location": "West Europe"

        },

        "databases": [

            {

                "connectionStringName": "",

                "databaseName": "",

                "serverName": "",

                "user": "",

                "password": "",

                "edition": "",

                "size": "",

                "collation": ""

            }

        ]

    }

}

  • As you can see from the script above, I’ve named my CFWebSiteDemo-Dev. Personally I find it useful to copy this file once for each environment (Dev, test, uat, prod), then when I’m deploying I just need to call the right configuration file.

  • Open up an Azure PowerShell Window.
  • Connect using your account. Add-AzureAccount press enter. You will be asked to sign into your Azure account.
  • Type Get-AzureSubscription to see all the subscriptions linked to your account(s). You need to ensure that your subscription you want to use is your current subscription.
  • Type Select-AzureSubscription –SubscriptionId [SubscriptionID]. This should now make your subscription the current subscription. Call Get-AzureSubscription to make sure. Read Handling Azure PowerShell with multiple Azure Subscription if you are still having issues up to this point.
  • Now navigate to your directory in the Powershell window. Mine is at c:\deploy. Cd deploy
  • Now type ./publish-webApplicationWebSite.ps1 –Configuration [Location of correct environment.json file] –WebDeployPackage [Location of zip file]
  • This will create the website in Azure, and then install the files. You will get a screen very similar to below.


NOTE: If you encounter an error when the website is trying to be created, then it will not upload the files. I have had this a few times before. Just check that the Azure website exists in your Azure Tenant and seems to be looking OK, then call the .\Publish-WebApplicationWebSite.ps1 command again. (You might need to try a new Azure PowerShell window.) Other reason why it fails could be due to how your company locks down your network. If you are having no success, try on a network (Starbuck wireless) that doesn’t have a network policy. If it then seems to work on that network, then you have something preventing the upload in your network, and will need to work through the problem with your network administrators.

  • As you can see in my tenant I now have a web app called CFWebSiteDemo-Dev.

  • My Website is up and running.

 

Upgrading Azure Website.

Upgrading the Azure website is very easy, make your changes and then create a new publish zip file.

Use the original PowerShell files and configuration files for Deploying Azure follow these steps.

  • Open up the Azure Windows PowerShell as Administrator.
  • Ensure you have added the account and subscription to your PowerShell profile if you haven’t done the previous steps.
    • Get-AzureAccount –Checks if account is there.
    • Get-AzureSubscription – Checks if Subscription is there.
    • Select-AzureSubscription –SubscriptionName [subscriptionName] –Selects the Subscription to deploy to.
  • Deploying files to Azure
  • Type ‘./Publish-WebApplicationWebsite.ps1 –Configuration [Location of correct environment .json file] –WebDeployPackage [Location of new zip file]
  • Your updated website should now be up and running.

SQL Azure – Creating SQL Azure Server and Database using PowerShell


In the past two blog for SQL Azure, I have shown you how to use the Azure Management portal to create a SQL Azure Server and Database and then update the firewall rules. This blog post is going to show you how you can do the exact same thing via PowerShell.

All the different PowerShell Cmdlets for managing SQL Azure can be found at the MSDN link https://msdn.microsoft.com/en-us/library/azure/dn546726.aspx.

  • Connect to Azure
Add-AzureAccount
  • This will pop up a Microsoft sign in dialog.
  • Sign in with your Azure username and Password.
  • If you know your subscription name you can do the following, otherwise you might need to call Get-AzureSubscription to list all subscriptions you have to find the name, and ID.
$subscriptionName = 'Windows Azure MSDN – Visual Studio Ultimate'

Select-AzureSubscription –SubscriptionName $subscriptionName

#Below is if you have PowerShell Azure version greater than 0.8.14 (get-module azure).version

#subscriptionID = "a222bcff-ac30-554d-67a5-1d6664f1a555"
#Select-AzureSubscription –SubscriptionID $subscriptionID
  • Next step is to create the Azure SQL Database Server. Remember you don’t get to assign a server name.
$location = 'West Europe'
$adminLogin = 'SQLAdmin'
$adminPassword = 'MyPa55w0rd'
$sqlDB = 'DemoDatabase'
 
$sqlServer = New-AzureSqlDatabaseServer –AdministratorLogin $adminLogin –AdministratorLoginPassword $adminpassword –Location $location

  • The above screen shot appears after the SQL server has successfully been created. To view all your SQL Servers type
Get-AzureSqlDatabaseServer
  • If you now try to connect to SQL Azure, you will encounter a firewall warning.
#Either get credentials for SQL authentication by prompting
$cred = Get-Credential
$sqlctx = New-AzureSqlDatabaseServerContext –ServerName $sqlServer.Name –Credential $cred
 
#Or create a Credential object that includes your login information.
$securePassword = ConvertTo-SecureString 'MyPa55w0rd' –AsPlainText -Force
$manualCredential = new-object System.Management.Automation.PSCredential('SQLAdmin',$securepassword)
$sqlctx = New-AzureSqlDatabaseServerContext –ServerName $sqlServer.ServerName –Credential $manualCredential

  • Therefore we need to create a Firewall rule to allow connections to the database server, the IP address is shown in the message above, I’ve hidden mine. The start and end IP address can be the same, or you can put a range in.
New-AzureSqlDatabaseServerFirewallRule –ServerName $sqlServer.ServerName –RuleName 'myOffice' –StartIPAddress '111.111.111.111' –EndIPAddress '222.222.222.222'

  • The above screen shot appears after the SQL server firewall entry has successfully been created. To view all your firewall rules for this server type
Get-AzureSqlDatabaseServerFirewallRule –ServerName $sqlServer.ServerName
  • Now if we retry the step to connect you don’t get the error message. This allows us now to use the context to create a new database. Ensure you include the Edition otherwise the retired “business” edition will be created for you.
New-AzureSqlDatabase –DatabaseName $sqlDB –ConnectionContext $sqlctx –Edition Standard

  • As you can see from above the MaxSizeGB is 1. Not very big. I’m therefore going to increase this to 10GB. (As in my screenshot above I forgot to add –Edition as Standard, you can also use the Set-AzureSqlDatabase cmdlet to change Database Edition.
Set-AzureSqlDatabase –ConnectionContext $sqlctx –DatabaseName $sqlDB –MaxSizeGB 10

 

By using SQL Management studio and connecting to my server I can see that my database has been created.

If I log into the Azure Management Portal I can see:

  • SQL Database and Server

  • Firewall rules

Lastly if you wish to clean up and remove database and Server, just run the following PowerShell, you will be prompted for a confirmation for both commands.

# Delete the database
Remove-AzureSqlDatabase –ConnectionContext $sqlCtx –DatabaseName $sqlDB
 
# Delete the Server
Remove-AzureSqlDatabaseServer $sqlServer.ServerName

 

Installing Azure PowerShell


There are lots of Azure Cmdlets available so that you can manage your own Azure environment with Windows PowerShell. To be able to run any of these Cmdlets inside your PowerShell window, you first need to Install Azure PowerShell modules.

There are two ways of installing Azure PowerShell:

  1. PowerShell installer at Git Hub.
  2. Using the Web Platform Installer

Git Hub PowerShell installer

For the Git Hub PowerShell installer visits https://github.com/Azure/azure-powershell/releases and click the Windows Standalone link.

Run the file, and then just step through the Microsoft Azure PowerShell Setup Wizard.

Microsoft Web Platform Installer

You might find this is already on your PC/Server so you can just open it from here.

If not you can download it directly from Microsoft at the following Url: http://www.microsoft.com/web/downloads/platform.aspx

Once installed and the Microsoft Web Platform Installer opens, if Microsoft Azure PowerShell with Microsoft Azure SDK not showing on the screen under the spotlight tab, (as it was for me) use the search box and search for Azure PowerShell.

Click Add

Then Install

Then I Accept.

Azure PowerShell will then start to download and install.

Once installed successfully you will get a successfully installed message. Click Finish, and Exit the Web Platform Installer.


Running the Azure PowerShell

Now that everything has been installed, you should now have a application call Microsoft Azure PowerShell in your menu.

Last note: If you find that when using PowerShell ISE after installing Azure PowerShell, doesn’t have the Azure cmdlets in the intellisense, you will need to reboot your PC that you have installed it on. I thought this was a must, as the few servers I have installed this on in the past few days required a reboot, but the server I’ve just done it on now to take these screen shots, didn’t require a reboot and worked straight away.

 

Setting up PowerPoint Automation Services for SharePoint 2013


  1. Setting up Word Automation Services for SharePoint 2013
  2. Setting up PowerPoint Automation Services for SharePoint 2013
  3. Converting a Library’s Word Documents to PDF
  4. Converting a Library’s PowerPoint documents to PDF
  5. Using ITextSharp to Merge PDF’s into one
  6. Using ITextSharp to create basic PDF page from item property

Microsoft PowerPoint Automation Services is a new feature of Microsoft SharePoint Server 2013. Using PowerPoint Automation Services, you can convert PowerPoint (.pptx and .ppt) file to supported document formats (.pptx, .pdf, .xps, .jpg and .png).This blog post will walk you through the steps of setting up your SharePoint 2013 on premise farm to use PowerPoint Automation Services. Unlike with Word Automation Services, this cannot be configured from inside Central Admin.

clip_image002

To create this service PowerShell must be used. This feature is not available with SharePoint Online.Before you start, ensure in your AD you have created a service account. Mine is called PowerPointAutomation.

  1. Open up a PowerShell command window or PowerShell ISE.
  2. First we need to create the Managed Account in SharePoint. This can either be done by directly in SharePoint Central Admin by registering a new Managed Account https://<CentralAdminUrl>/_admin/ManagedAccounts.aspx
    clip_image004
    clip_image006
    Or we can do it with PowerShell

    add-pssnapin Microsoft.SharePoint.Powershell
    
    $cred = Get-Credential
    New-SPManagedAccount -Credential $cred
    

    When run, this will display a Credential box, put in here your Service account and password

    clip_image008

    Your Managed Account will now be registered with SharePoint.

  3. Now we can run the following script to create the PowerPoint Automation Service and Proxy. (Remember to change your service account)
    add-pssnapin Microsoft.SharePoint.Powershell
    
    #Create a new Service Application Pool Account
    New-SPServiceApplicationPool -Name "PowerPointAutomationAppPool" -Account cc\PowerPointAutomation
    #Get the Service Application pool
    $pool = Get-SPServiceApplicationPool | where {$_.Name -like "PowerPointAuto*"}
    #Create the PowerPoint Conversion Service
    $ppt = New-SPPowerPointConversionServiceApplication "PowerPoint Conversion Service" -ApplicationPool $pool
    #Create the Proxy for Service
    New-SPPowerPointConversionServiceApplicationProxy "PowerPoint Conversion Service Proxy" -ServiceApplication $ppt –AddToDefaultGroup
    

    Once complete your powershell window should look similar to mine below.

    clip_image010

    Also if you navigate in Central Administration back to your Service Applications, you will now see the PowerPoint Conversion Service Application and Proxy within the list.
    clip_image012

  4. For the PowerPoint Conversion Service to work, you will need create a new folder called PowerPointConversion on the server running the PowerPoint Conversion Service in the following location. C:\ProgramData\Microsoft\SharePoint. This folder directory is a hidden folder and you will need to show Hidden items in the ribbon of explorer to see it.
    clip_image014

    clip_image016
    clip_image018
  5. Once you have created this folder, view the security on this folder (Right click folder, click Properties, view the Security Tab) and give WSS_WPG Modify permissions. This will allow the Web Application pool service account to create folders and files within the newly created PowerPointConversion folder, which is required to convert a PowerPoint document.
  6. Lastly in Central Administration, under system Settings click on Manage Services on Server, and ensure that you have started PowerPoint Conversion Service.image

In Part 4 of these blog posts I will demo how to code against the PowerPoint Automation Services to convert PowerPoint Documents to PDF.