SP2010: The hidden TaxonomyStaplerFeature

I am a big fan of keeping things clean. The more you clutter, the more chance of faults you might not have expected. Today, I learned that sometimes cleaner is not better.

I like using the blank site template to create new sites. Most people tend to use the team site, but that already has a document library, calendar and a number of preactivated features. Nice to start a team site, but what if the site you’re creating is not a team site?? As I said; I like starting clean.

But amongst the features not being activated by default on a blank site is a tricky one: the TaxonomyStaplerFeature (ID 73EF14B1-13A9-416b-A9B5-ECECA2B0604C). This is a stapling feature which in it’s turn activates multiple other hidden features. You need it for several taxonomy related things, like subscribing to content types from an enterprise content hub. And as said; the features are hidden, so you can only enable them if you have server access.

So I guess we’ll need another stapling feature, to staple the missing features to the blank site definition!? :-) I’m not sure yet if this is the only one which messes up pretty regular functionality. I don’t mind features I don’t use that often being off, but this one should have been on by default in my opinion. Or they could have provided another template: “blank site with no functionality whatsoever”.

Sapstromen

Een paar weken terug hoorde ik voor ‘t eerst over sapstromen. Het schijnt dat planten die nodig hebben om blaadjes te krijgen en in de winter doen ze het dus blijkbaar niet. Het was een paar dagen lekker weer en meteen verwachtte heel Nederland dat zijn of haar tuintje wel in volle bloei zou staan. Niks daarvan. Maar okee, de sapstromen beginnen inmiddels hun werk te doen en ik kan al bijna niet meer door mijn heg heen kijken.

Dat gedoe over sapstromen deed me denken aan iets wat me al een tijdje fascineert. Pisvrees. Voor de vrouwelijke lezers van mijn blog: daar hebben sommige mannen last van. Ik persoonlijk niet overigens, laten we dat voorop stellen. Als ik moet, dan moet ik; het zal me werkelijk een worst (hèhè…) wezen hoeveel man er dan naast of achter me staat. Een ieder van mijn mannelijke vrienden zal kunnen bevestigen dat ik probleemloos mijn fiere straal in de pot laat kletteren. Dat maakt het ook dat ik me lastig kan verplaatsen in het hele verschijnsel.

Van wat ik heb begrepen maakt de pisvrees het onmogelijk om je plas te lozen wanneer er andere kerels in de buurt zijn. En tja, op sommige toiletten is dat nu eenmaal zo. Zeker als de hokjes bezet zijn, of af en toe te smerig voor woorden. En daar sta je dan, met je volle blaas. Dat is dus precies het gedeelte wat ik niet zo snap. Als je moet en je gaat niet; dan pis na een tijdje toch in je broek? Lijkt me toch net ietsjes genanter.

Begrijp me niet verkeerd: het lijkt me super vervelend, ik heb het te doen met de mannen die hier onder gebukt gaan. Iedere keer in spanning naar het toilet, hopend op een leeg en fris hokje. En ik vraag me meteen af: werkt het in een hokje dan wel meteen? Wat nu als het hokje naast je bezet is en de tijdelijke eigenaar van die twee vierkante meter grond er wat geluid bij maakt? Lastig.

En nu ik er zo over mijmer vraag ik me af of vrouwen hier überhaupt wel eens last van hebben!? Ik bedoel; die gebruiken nooit een urinoir of goot. Altijd in een hokje. Dus bestaat er wel zoiets als vrouwelijke pisvrees? Wat een raadsels.

Een hoop van onze gewoonten en gedragen zijn op een of andere manier terug te herleiden naar “de oermens”. Ons sociale gedrag, het “bij de groep willen horen”; dat doe je omdat je vroeger als eenling ten dode opgeschreven was. Voer voor de leeuwen. Maar wat dan als je buiten de groep, ergens achteraf je plas moet doen? Ga er maar aan staan! We mogen dus wel concluderen dat deze mannen eigenlijk de echte bikkels zijn. Niks om mee te spotten! En verder: succes.

 

WCF service using Azure relay and ADFS authentication (2/2)

In the second part of this article (read part 1 here), we’re going to extend our relayed service with AD (Active Directory) authentication. In most cases you’ll need authentication to provide some security for your business data. In this example, we’re keeping it simple; just using a valid domain account to access the data. All (enabled) accounts are valid. But with some extending, you can quite easily adapt this code to work with AD groups for instance, making sure only certain users can get to the data. This is done by using claims, perhaps I’ll cover that in a third article. Continue reading

WCF service using Azure relay and ADFS authentication (1/2)

What I’m going to write about in this two-part article is what could be considered quite a common scenario. Your company wants to expose data to its employees outside of the internal network. Take a mobile app (or Windows 8 app) for instance, which gets its data from a legacy back-end system. In “old fashioned” scenario’s, you could:

  • Create a WCF webservice to host the data.
  • Deploy the webservice into some kind of secured network zone (DMZ).
  • Kindly ask the firewall admins to open up a port to your service.
  • Register a DNS address which makes it easier to call your service.
  • Request SSL certificates and secure your service so only encrypted data is sent.

In this article, I’ll write about how Azure can make your life easier by handling some of these things in a different way. You, as a reader, should be familiar with WCF and have a basic understanding of authentication schemes. Some knowledge of what ADFS is would be handy too.

There’s two Azure topics I want to talk about: relay and ACS. In the first part of this article, we’ll talk about relay. How to setup ACS with ADFS will be topic of the second part.

 

Setting up the service bus in Azure

Relay is a technique which enables you to register your WCF service with Azure. Once registered, clients are able to call Azure instead of your service directly. And because the service initiates the communication, you only need access to the Internet, not from it. In Azure, this is handled by the service bus, which is a multifunctional messaging system. Relay is only a part of the functionality.

Here’s what happens in general:

  1. The service registers itself with Azure .
  2. Azure acknowledges the registration. The connection is kept open for future use.
  3. A client now connects to the endpoint registered with Azure and sends a webservice request.
  4. The request is relayed to the local WCF service.
  5. The result is passed back to Azure.
  6. The service bus passes the result to the client.

For you as a developer, this has some advantages:

  • The call to Azure is https secured, so all data going to Azure is always encrypted. No need to purchase an SSL certificate.
  • Same goes for data going to the client, encrypted as well.
  • No need to open up any firewall ports. Default internet access is enough to make this work
  • Although I haven’t thoroughly tested this, it should work in all kinds of proxy-enabled scenario’s too.

Ok, cool. So what do you need to make this work? To begin with, you’ll need a Windows Azure account. Open up the management portal (https://manage.windowsazure.com/) and go to the “service bus” section. Click “Create” and choose a namespace for your service bus instance:

You can request the access key once you created the service bus instance. This key is used to authenticate server / client with the service bus. In part 2, we’re going to use ACS / ADFS for that, in which case the shared secret access key is irrelevant.

Creating a relayed WCF service

Once you’ve got your service bus namespace setup, it’s time to create a service. Most easy way is to create a console application which will use a ServiceHost object to self-host the service. The most important thing here are the bindings. You will have to use two bindings:

  • One normal binding (like BasicHttpBinding) which hosts the service in a normal way, for instance on http://localhost:1234.
  • A matching relay binding (in this case BasicHttpRelayBinding) which is used to connect to Azure and relay the service.

Assuming some WCF knowledge, creating a service host should be easy:

ServiceHost serviceHost = new ServiceHost(typeof(CalculatorAPI), new Uri(serviceEndpoint));

Registering the endpoints and bindings:

serviceHost.AddServiceEndpoint(
  typeof(ICalculatorAPI), new
  BasicHttpBinding(), "/"
);

serviceHost.AddServiceEndpoint(
    typeof(ICalculatorAPI), new BasicHttpRelayBinding(
        EndToEndBasicHttpSecurityMode.None, 
        RelayClientAuthenticationType.None),
    ServiceBusEnvironment.CreateServiceUri("https", "calculator", "api"))
    .Behaviors.Add(new TransportClientEndpointBehavior
    {
        TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", "<<azure_access_key>>")
    });

The things to notice:

  • The bindings need to match. So use a BasicHttpRelayBinding in combination with a BasicHttpBinding and not a WsHttpBinding for instance.
  • Both endpoints register the same interface class, so both endpoints know which methods your service will provide.
  • For the relay binding, you specify the service bus address with the help of the CreateServiceUri method. This asks for a scheme, the namespace you created earlier and a service path which can be anything you like.

In the example for part 2 (ADFS), we’ll switch from using a SharedSecretTokenProvider to a SamlTokenProvider used with SAML tokens.

Basically, that’s all you need to do on the server side. Simple, right? You could create one extra endpoint to provide a mex metadata exchange binding. The code to do that:

// Check to see if the service host already has a ServiceMetadataBehavior
ServiceMetadataBehavior smb = serviceHost.Description.Behaviors.Find<ServiceMetadataBehavior>();

// If not, add one
if (smb == null)
  smb = new ServiceMetadataBehavior();

smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
serviceHost.Description.Behaviors.Add(smb);

// Add MEX endpoint
serviceHost.AddServiceEndpoint(
    ServiceMetadataBehavior.MexContractName,
    MetadataExchangeBindings.CreateMexHttpBinding(),
    serviceAddress + "/mex"
);

I would advise to use the mex endpoint only in development environments and leave it out for production. But that’s up to you, it doesn’t really matter that much.

Add a serviceHost.Open(), run your console app and see if it properly registers itself with Azure. Once it does, you should be able to create a client and connect with it.

Creating a client to match

Creating a client follows the same principles. The client counterpart of a ServiceHost is the ChannelFactory. Because it shares the interface definition, it’s wise to keep that class in a shared library. But you could also make use of the local endpoint and the “Add Service Reference” functionality of Visual Studio, which will generate an interface class for you. As long as the interface class has the same methods and signatures as your service has, you’re good.

var cf = new ChannelFactory<ICalculatorAPIChannel>(
    new BasicHttpRelayBinding(),
    new EndpointAddress(ServiceBusEnvironment.CreateServiceUri("https", "calculator", "api")));

Now, as we did with the service, we need to specify the endpoint behaviour:

cf.Endpoint.Behaviors.Add(
    new TransportClientEndpointBehavior {
        TokenProvider = TokenProvider.CreateSharedSecretTokenProvider("owner", "<<azure_access_key>>")
    });

And with that setup, you can simply create a channel and call the method of choice!

using (var ch = cf.CreateChannel())
{
    var answer = ch.Add(10, 6);
    Console.WriteLine("Answer: {0}", answer);
}

So the cool thing is, apart from some configuration and setup, it’s really not that hard to setup a relayed service. In my opinion, this is far less complicated than convincing the firewall guys to open up ports for you ;-)

This service is secure. All the communications are encrypted via SSL and both client and server need to know the shared access key to be able to connect to the service bus. But this method of authentication is pretty limited and not really usable in mobile apps scenario’s (how do you prevent some unauthorized user from using the app?). So in the follow-up of this article I will explain how to extend the sample with ADFS integrated authentication. That article will also contain a full code sample.

Update: and here’s part two.

Installing a windows service with Visual Studio 2012

Since Visual Studio 2012, the default installer project was switched for a limited edition of InstallShield. I won’t get into the discussion whether this was a step forward or backward, but it’s there.

When you’re building an installer for Windows Service, you might get stuck in the situation where the installer is deploying your files onto the filesystem, but the actual service isn’t appearing in the services console. That’s because the installer class didn’t get called to register the service. For those of you who don’t know; you need to add an installer class to your service which registers it with Windows (you can easily do so by right clicking the service and choosing “Add installer”.

Anyways. If this is the case, go to “Files” in step 2 of the installer and open it up. Right click your project and open up the properties window. Go to the second tab “COM & .NET Settings”.

COM settings

There, you’ll find a checkbox “Installer Class” which you need to enable. Now compile your installer again and there you go: it’ll register your service in Windows again.

SP2010: Errors in content deployment

This is a topic which comes up more then once when you’re working with the content deployment feature. For those of you unfamiliar with content deployment; it’s basically a process to import and export a site collection in an automated way, across farms if you like to.

But content deployment is a tricky process in which a number of things can go wrong. Most of the solution I’m going to mention are not new, but I could not find a blog which combines them all, so that’s wat I did.

Continue reading

Goedkoop is duurkoop?

Ik heb de laatste tijd weer wat spulletjes gekocht. Eens in de zoveel tijd is het weer zover, dan komt die behoefte naar boven. En hoewel ik me soms wel eens laat verleiden tot minder briljante aankopen moet ik zeggen dat de meeste euro’s toch goed besteed worden. Weinig spijt, tot nu toe…

Ik weeg m’n keuzes dan ook altijd goed af. Er wordt vooronderzoek gedaan op internet, waar ik zowel kijk naar de professionele reviews als gebruikerservaringen. Daar laat ik me meestal grotendeels door leiden, ik vind dat meer waard dan het verkooppraatje wat een verkoper in de winkel me kan vertellen. Natuurlijk, die hebben misschien verstand van zaken en zijn dagelijks met die spullen bezig. Maar toch; ze staan daar om je iets te verkopen. Omzet, dat is waar het onderaan de streep om draait.

Bij sommige beslissingen komt het onderbuik gevoel kijken, je kent het vast. Soms is dat gevoel positief, je beslissing “voelt” gewoon goed. En soms werkt het tegen je, denk je dagenlang nog “heb ik daar nu wel goed aan gedaan”. Dat laatste gevoel heb ik bij de aankoop van mijn was/droog combinatie. Door vele mensen afgeraden, toch gedaan. En of ik er goed aan heb gedaan, dat zal de tijd leren. Als je dat onderwerp interessant vindt, trouwens, lees dan vooral het boek “Start with why” van Simon Sinek, waarin wordt uitgelegd waarom beslissingen soms goed of juist niet goed voelen. Aanrader!

Goed, op naar de moraal van dit verhaal: een beslissing is meer dan alleen het afwegen van de positieve en negatieve punten. Er komt gevoel bij kijken en in sommige gevallen spelen er aan de zijkant nog allerlei belangen. Zo koop je waarschijnlijk eerder een fiets van je oom die een fietsenwinkel heeft, dan van een willekeurige andere fietsenboer. Niet omdat die fietsen nu per se beter of goedkoper zijn, maar omdat het je oom is. Is dat dan goed of slecht? Geen idee, maar het voelt als de juiste beslissing.

Toch proberen we in Nederland (en in de EU en daarbuiten net zo goed) kostte wat kost alle niet rationele overwegingen bij een aankoop zoveel mogelijk buitenspel te zeggen. En dan noemen we dat vervolgens: de aanbesteding. Het idee achter een aanbesteding is eenvoudig: je zet op papier wat je wilt hebben, laat aanbieders je daarop een voorstel doen en kiest vervolgens “de beste”. Maar is dat dan ook echt de beste? Stel dat 2 aanbieders beweren dat ze je exact hetzelfde kunnen leveren, maar aanbieder A) is 20% goedkoper. Op basis van de rationele feiten zou je zeggen: doen! Op basis van je onderbuik gevoel misschien niet?

Die aanbestedingen doen we niet omdat we daar zin in hebben, die doen we omdat het moet. Nog voor de aanvraag de deur uit gaat is het al geen vrije beslissing meer. Weg onderbuikgevoel. En dus zitten we nu met, ik noem maar wat, een Fyra die niet rijdt. Die voldeed op papier aan alle eisen en was goedkoper dan de concurrentie. Maar ja, die eisenlijst is altijd op meerdere manier te interpreteren. En wie zegt dat die gekke Italianen niet een paar vinkjes hebben gezet in kolommetjes, waar ze eigenlijk geen vinkje hadden mogen zetten? Vraag me af welke beslissing er genomen was wanneer de NS naar haar onderbuikgevoel had geluisterd.

Auto SP Solution Installer

Update 01-02-2013 As seen below in Matthias his reaction, there is already a similar project on Codeplex which I’ve clearly overlooked. I’m currently seeing if we could join forces (although their project is already very mature). So the Auto SP Solution Installer might have a short lifetime and merge into spsd.codeplex.com.

Today I published my first Codeplex project. It’s called “Auto SP Solution Installer”, based upon the well known “Auto SP Installer” from which I borrowed some code.

The goal of the project is to easy the deployment process of solutions across farms in a DTAP environment. At a lot of my customers, I notice there’s a lack of SharePoint knowledge at the administration side. The administrators sometimes barely know what they’re doing, or they’re just doing what they are told by the developers. Or even worse: the developers are deploying stuff themselves.

Let’s be honest: the Auto SP Solution Installer can’t fix a faulty lifecycle process. But it can automate some of the steps, making sure the room for error get’s smaller.

The current feature set is as follows:

  • Adding, removing, installing and updating your WSP files
  • Deploying WSP’s to specific web applications
  • Scheduled deployment of WSPs to prevent downtime
  • Warning the farm administrator about maintenance compliancy and GAC deployments
  • Installing, uninstalling, enabling and disabling features (scoped)
  • Using the same deployment configuration across all your farms in a DTAP environment. Farm configuration is seperated from solution configuration.

Basically, you create a deployment configuration (XML) and provide some WSP’s. In a seperate configuration file, the farms (yes, multiple) are described. The script figures out on which farm it’s running, which web applications exist, etc.  and then deploys your solutions as configured. The same package of WSPs and config XML can then be moved to the next farm (test, acceptance, production) and re-used there without changing anything.

Also, the script will warn the administrator about maintenance windows and GAC deployments which will cause downtime to all of your web applications (IIS reset).

Interested? The first initial release can be found on Codeplex: http://autospsolinstaller.codeplex.com

Aan alle Prius rijders

Afgelopen week was er in de media veel te lezen over dit bericht: ‘Groene’ auto vaak niet zo zuinig (via NOS). Ik had even het idee dat ik een déjà-vu had. En terecht! Tik op google maar eens “zuinige auto niet zo zuinig” in (of klik hier). Genoeg berichtjes uit 2010 en eerder die over hetzelfde onderwerp gaan.

Het verhaal is heel eenvoudig. Fabrikanten geven allerlei schitterende cijfers op voor hun zuinige modellen. Met deze auto’s draagt u een steentje bij, wordt de aarde een beetje groener, dat soort onzin. De overheid wil graag dat wij om het milieu denken en heeft daarom allerlei belastingvoordeelregeltjes bedacht voor mensen die graag in een Prius stappen. Ik zou er persoonlijk nog niet dood in gevonden willen worden, maar dat terzijde. Ik zou sowieso niet graag dood gevonden worden, ook dat terzijde.

En nu (en al eerder blijkbaar dus ook) blijkt dat die ‘groene’ rijders helemaal niet de verbruikscijfers halen die door de fabrikant zijn opgegeven. Joh! Tot zover nog niks nieuws onder de zon zou je zeggen. Zou je zeggen, want blijkbaar is Den Haag hier wel heel verbaasd over. Er wordt nu ineens gevraagd om nieuwe tests.

Hoi mensen in Den Haag. Ik heb alvast een nieuwe test bedacht. Vraag aan de leasemaatschappijen de kilometerstanden en de getankte liters brandstof op. Deel het een door het ander, dan weet je precies wat een auto verbruikt. Bereken zo per maand of jaar het bijtellingspercentage en beloon de zuinige rijder. De rijder die zijn best doet om netjes te rijden en weinig brandstof te verbruiken. En niet de rijder die kiest voor de leukste cijfertjes in de folder. Als u mij voor dit briljante idee mocht willen sponsoren met een leuk bijtellingstarief, mijn gegevens zijn reeds bij u bekend.

Ik hoop dat ze die belastingvoordeeltjes met terugwerkende kracht terugdraaien. En dan vooral voor de Prius rijder die mij met 150 voorbij komt stuiven op de snelweg. Dat zijn vast dezelfde mensen die zo geirriteerd zijn om de Grieken en hun belasting-ontduik-fratsen. Maar ondertussen wel 14% bijtelling aftikken voor een auto die op die manier geen steek zuiniger is dan een normaal model. En lelijk.

Werken bij een groot bedrijf? Doen!

Nu ongeveer een half jaar geleden stopte ik met mijn baan bij mijn vorige werkgever. Na 5 jaar vond ik het tijd voor iets anders en ben ik op zoek gegaan naar de volgende stap in mijn carriere. Zoals je misschien weet, of anders kunt lezen op mijn site, werk ik tegenwoordig voor Atos (vroeger Atos Origin, die van het visje). En hoewel ik daar qua werkzaamheden ongeveer hetzelfde doe, is dit toch echt wel een andere baan. Van ongeveer 75 medewerkers naar 75.000 collega’s. Veel mensen vragen me: hoe is dat dan, werken bij zo’n groot bedrijf? Bij deze.

Vanaf het moment dat je naar je sollicitatie gaat is meteen wel duidelijk dat dit wel even iets anders is. In mijn geval mocht ik naar de HighTech campus in Eindhoven, wat sowieso al een toffe en inspirerende omgeving is. Er zitten daar veel tech bedrijven, namen waarvan je meteen denkt: “Hey! Ken ik!”. Een goed begin dus. De sollicitatie procedure was eigenlijk heel eenvoudig. Geen tests ofzo, gewoon twee gesprekjes en babbelen over je CV en ambities.

Eenmaal aangenomen begin je met (in mijn geval) 2 introductiedagen. De eerste dag krijg je, naast een stuk of 40 andere collega’s (wederom: in mijn geval, dat aantal schijnt te wisselen), meteen je toegangspas, laptop, SIM-kaart, VPN token, noem het maar op. De vrijdag ervoor had ik m’n pouleauto al voor de deur staan, werd bezorgd. Luxe! Tijdens de introductiedagen krijg je te horen hoe het bedrijf in elkaar zit, welke onderdelen er zijn en wat die doen. Ook wat er van je verwacht wordt; hoe je je uren inboekt, waar je e-learning modules kunt volgen, noem maar op. 2 Dagen volop informatie waarvan niet alles blijft hangen, maar het is een goed begin. En nog steeds kom ik soms collega’s tegen van “de intro”, lachen!

En dan aan de slag. De eerste dagen krijg je een buddy toegewezen die je wegwijs moet maken binnen het bedrijf. Daar kun je terecht met vragen, handig. Je gaat je Atos profiel maken zodat je aangeboden kunt worden aan klanten (afhankelijk van je functie natuurlijk). Even uitzoeken welke telefoon je wilt kopen van je budget in de phoneshop. Kortom: meteen onderweg. Netwerken is belangrijk, je collega’s wijzen je al snel op de koffieautomaat (hoewel ons nieuwe Enterprise Social Network deze snel moet gaan vervangen). Laat je zien en zorg dat mensen weten dat je openstaat voor opdrachten.

En dan het dagelijkse werken. Thuiswerken? Graag! De kantoorlocaties zijn beperkt, dus thuiswerken is geen vraag maar een must. Samenwerken doe je ook veel online. En soms face-to-face, bijvoorbeeld op ‘t Flight Forum in Eindhoven of in Utrecht. Dus ja, ik zit snel een uurtje in de auto om ergens te komen. Maar ook dat valt helemaal niet tegen. Gewoon op tijd weg (wel vroeg opstaan) maar vaak al voor 6 uur weer thuis. Dat lukte me bij mijn vorige baan nooit.

En er gebeurd echt vanalles! Zo hebben we een App Academy waar smartphone / tablet apps ontwikkelt worden. We hebben het Enterprise Social Network waar ik al over vertelde; een soort Facebook voor bedrijven. We hebben communities over allerlei onderwerpen waar je je voor kunt inschrijven. Die organiseren weer vaak (avond) sessies waar je veel van opsteekt. Weet je iets even niet zelf? Dan is de kans groot dat een collega je kan en wil helpen. En eigen initiatieven worden gewaardeerd! Dus ben ik nu community lead voor SharePoint, waardoor ik regelmatig online meetings heb met mensen uit Duitsland, Frankrijk en zelfs China. Boven het maaiveld uitsteken en opvallen in de menigte kan niet bij een groot bedrijf? Onzin. Tenminste, bij Atos dan.

Dus ja, ik zit wel op mijn plek! Mijn huidige opdracht loopt nog tot eind februari en dan gaan we weer kijken naar een nieuwe. En als het goed is ga ik nog ergens mijn best doen om de master opleiding voor SharePoint te volgen. Met misschien wel een tripje naar Redmond in het verschiet.

Werken bij een groot bedrijf? Doen!

Oh en ik moet er natuurlijk bij vermelden: als je interesse gewekt is, neem dan gerust contact op met me (jasper.siegmund@atos.net). Dan zorg ik dat je gegevens terecht komen bij recruitment. Of als je zelf contact opneemt, noem dan even mijn naam. Kan ik weer een leuk weekendje weg boeken ;-)

Atos