Time to wake up the blog

I have spent the last 18 months – 2 years building tooling to automate the stand up / configure / tear down of various Azure virtual environments for various clients. ┬áThis is partly why the blog has been very quiet ­čÖé

I figure I have a pretty stable and workable solution based upon custom PowerShell scripts, some base VM images and some scheduled PowerShell tasks.

While I was busy doing this, M$ were building pretty much the same thing, calling it Azure Resource Manager.

This is what I must now get to grips with, cross technology training seems to be imminent.

To be fair, the M$ offering does at first glance look slightly improved on my ‘original’

Azure Resource Manager

SharePoint on-line 2013 web service call to execute a CAML query against a list

Well, talk about a journey; If you will be doing any SharePoint on-line 2013 workflows, you are going to need to understand this.

These were my inspiration
Great tutorial
Great Fiddler reference

Without those two, I would still be there at Christmas.  This is my summary;

I am querying a list in a sub web called ‘Config’ for a list Called ConfigItems

First you need to grab the auth cookies, browse to https://yourSPonline.sharepoint.com

FIDDLER: Get ContextInfo to grab a form digest from: This is a GET
https://yourSPonline.sharepoint.com/_api/contextinfo”

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;
Host: yourSPonline.sharepoint.com

Now, examine the json, find formdigest
Add it to your headers as X-RequestDigest
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000
So now you have

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;
Host: dev3.sharepoint.com
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000

Now you can call list api’s – Get all items from a sub web called Config USE A GET

https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/items”

or via CAML, this is a PUT

https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query><ViewFields><FieldRef%20Name=’Title’/><FieldRef%20Name=’ItemValue’/></ViewFields><Where><Eq><FieldRef%20Name=’ItemGroup’/><Value%20Type=’Choice’>SomeWorkflow</Value></Eq></Where></Query></View>”}
or
https://yourSPonline.sharepoint.com/Config/_api/web/lists/getByTitle(‘configitems’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query><ViewFields><FieldRef%20Name=’Title’/><FieldRef%20Name=’ItemValue’/></ViewFields><Where><Eq><FieldRef%20Name=’ItemGroup’/><Value%20Type=’Choice’>None</Value></Eq></Where></Query></View>”}

 

 

SharePoint 2013 – Workflow – FBA – Journey (on-prem)

If you are getting these ­čÖé

Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP Unauthorized to http://devVM.domain.dev/_vti_bin/client.svc/sp.utilities.utility.ResolvePrincipalInCurrentcontext

You may need this

Setting up SharePoint 2013 workflow is documented all over the internet, not all on one page though ­čÖé

This is how I got it all to work

Start here http://technet.microsoft.com/en-us/sharepoint/jj556245.aspx

  • Follow┬áreligiously┬áthis set of videos
  • Once configured enable site feature ‘WorkflowServiceStore’ use powershell Enable-SPFeature WorkflowServiceStore -Url http://yoursite
  • Now in the UI activate feature on your site ‘workflow can use app permissions’
  • Now grant full control to workflow ‘workflow’ http://msdn.microsoft.com/en-us/library/jj822159.aspx
  • wrap any steps of your workflow which fail for prmission related stuff in an “App step”

Simple eh ?

I guess we owe this complexity to SharePoint online and Office 365 (The future don’t you know)

Need to create users on Office 365 from a csv file

This came in very usefull the other day.

[CmdletBinding()]
param(
    [string] $inputCsvFile = "users.csv"
)
 
# Reference to site code originated from
#
# http://philwicklund.com/blog/Pages/Using-remote-PowerShell-to-manage-Office-365-identities.aspx
 
Import-Module MSOnline -ErrorAction silentlycontinue
connect-MsolService
 
$csvRows = import-csv $inputCsvFile
# Csv file format expected is
# column headings
# data rows
#
# where data rows are quote comma delimited fields
# agreeing with column headings
# e.g.
#
# "UserPrincipalName","DisplayName","FirstName","LastName","Password"
# "brian999@xyz.onmicrosoft.com","Brian T 999","Brian","T 999","p@%^*()"
 
$row = 0
$csvRows | % {
    $csvRow = $_
    $row++
 
    write-host "row:" $row $csvRow.UserPrincipalName
 
    #New-MsolUser    -UserPrincipalName $csvRow.UserPrincipalName `
    #                -DisplayName $csvRow.DisplayName `
    #                -FirstName $csvRow.FirstName `
    #                -LastName $csvRow.LastName `
    #                -Password $csvRow.Password
 
    #Set-MsolUser    -UserPrincipalName $csvRow.UserPrincipalName `
    #                -PasswordNeverExpires $true
 
    #Set-MsolUserLicence -UserPrincipalName $csvRow.UserPrincipalName `
    #                    -AddLicenses "xyz:ENTERPRISEPACK"
                        # -RemoveLicenses ""
 
    # Remove-MsolUser -UserPrincipalName $csvRow.UserPrincipalName
    # New-MsolGroup -DisplayName "Sales Executives" -Description "All sales staff"
    # $salesGroup = Get-MsolGroup | where-object { $_.DisplayName -eq "Sales Executives"}
    # $user = Get-MsolUser | where-object { $_.DisplayName -eq "Phil" }
    # Add-MsolGroupMember -GroupObjectId $salesGroup.ObjectId -GroupMemberType "User" -GroupMemberObjectId $user.ObjectId
    # Remove-MsolGroup -objectid $salesGroup.ObjectId
}