anchor.diff:      let defaultExtendedProperties = dict [ "IsMBraceAsset", "true"]
       let isMBraceAsset (extendedProperties:IDictionary<string, string>) = extendedProperties.ContainsKey "IsMBraceAsset"
   
  -    [<AutoSerializable(false)>]
  -    type AzureClient =
  -        { Subscription : string
  -          Credentials : CertificateCloudCredentials
  -          Storage : StorageManagementClient
  -          ServiceBus : ServiceBusManagementClient
  -          Compute : ComputeManagementClient
  -          Management : ManagementClient }
  -        static member OfCredentials (subscription:Subscription) credentials =
  -            { Subscription = subscription.Name
  -              Credentials = credentials
  -              Storage = new StorageManagementClient(credentials)
  -              ServiceBus = new ServiceBusManagementClient(credentials)
  -              Compute = new ComputeManagementClient(credentials)
  -              Management = new ManagementClient(credentials) }
  -
  -    module Credentials =
  -        let asCredentials (subscription:Subscription) =
  +    [<NoEquality; NoComparison; AutoSerializable(false)>]
  +    type SubscriptionClient =
  +        {
  +            Subscription : Subscription
  +            Credentials : CertificateCloudCredentials
  +            Storage : StorageManagementClient
  +            ServiceBus : ServiceBusManagementClient
  +            Compute : ComputeManagementClient
  +            Management : ManagementClient 
  +        }
  +
  +        static member Activate(subscription : Subscription) =
               let cert = new X509Certificate2(Convert.FromBase64String subscription.ManagementCertificate)
  -            new CertificateCloudCredentials(subscription.Id, cert)
  -
  -        let connectToAzure subscriptionOpt pubSettingsFilePath =
  -            let pubSettings = PublishSettings.ParseFile pubSettingsFilePath
  -            let subscriptions = pubSettings.Subscriptions
  -            if subscriptions.Length = 0 then
  -                invalidArg "pubSettingsFilePath" <| sprintf "no Azure subscriptions found in pubsettings file %A" pubSettingsFilePath
  -
  -            let subscription = defaultArg subscriptionOpt subscriptions.[0].Name
  -
  -            match subscriptions |> Array.tryFind(fun s -> s.Name = subscription) with 
  -            | None -> invalidArg "subscriptionOpt" <| sprintf "couldn't find subscription %s in %s" subscription pubSettingsFilePath
  -            | Some sub -> sub |> asCredentials |> AzureClient.OfCredentials sub
  +            let cred = new CertificateCloudCredentials(subscription.Id, cert)
  +            { Subscription = subscription
  +              Credentials = cred
  +              Storage = new StorageManagementClient(cred)
  +              ServiceBus = new ServiceBusManagementClient(cred)
  +              Compute = new ComputeManagementClient(cred)
  +              Management = new ManagementClient(cred) }
  +
  +    type PubSettingsClient =
  +        {
  +            Default : SubscriptionClient
  +            Subscriptions : SubscriptionClient []
  +        }
  +
  +        member c.GetClientByIdOrDefault(?id : string) =
  +            match id with
  +            | None -> c.Default
  +            | Some id -> c.Subscriptions |> Array.find (fun s -> s.Subscription.Id = id || s.Subscription.Name = id)
  +
  +        member c.Item with get (id : string) = c.GetClientByIdOrDefault(id = id)
  +
  +        static member Activate(subscriptions : seq<Subscription>, ?defaultSubscriptionId : string) =
  +            match subscriptions |> Seq.distinctBy (fun s -> s.Id) |> Seq.toArray with
  +            | [||] -> invalidArg "subscriptions" "supplied an empty set of Azure subscriptions."
  +            | subscriptions ->
  +                let clients = subscriptions |> Array.map SubscriptionClient.Activate
  +                let defaultSubscriptionId = defaultArg defaultSubscriptionId subscriptions.[0].Id
  +                let defaultSubscription = clients |> Array.find (fun c -> c.Subscription.Id = defaultSubscriptionId || c.Subscription.Name = defaultSubscriptionId)
  +                { Default = defaultSubscription
  +                  Subscriptions = clients }
   
       module Infrastructure =
  -        let listRegions (client:AzureClient) =
  +        let listRegions (client:SubscriptionClient) =
               let requiredServices = [ "Compute"; "Storage" ]
               let rolesForClient = set(client.Management.RoleSizes.List() |> Seq.map(fun r -> r.Name))
               client.Management.Locations.List()
  
positive.code:       </Role>
      </ServiceConfiguration>""" serviceName instances storageConnection serviceBusConnection
  
          let createMBraceCluster (logger : ISystemLogger, clusterName, clusterLabel, region, packagePath, config, storageAccountName, storageConnectionString, serviceBusNamespace, serviceBusConnectionString) (client:AzureClient) = async {
              do! validateClusterName client clusterName 
  
              let extendedProperties =
  
negative.code: 
      static member DeleteCluster(pubSettingsFile, clusterName, ?Subscription, ?logger : ISystemLogger) = async { 
          let logger = match logger with Some l -> l | None -> new NullLogger() :> _
          let pubSettings = PublishSettings.ParseFile pubSettingsFile
          let pubClient = PubSettingsClient.Activate pubSettings.Subscriptions
          let client = pubClient.GetClientByIdOrDefault(?id = Subscription) 
          return! Clusters.deleteMBraceCluster logger clusterName client
      }
  
      static member GetClusters(pubSettingsFile, ?Subscription) = async { 
          let pubSettings = PublishSettings.ParseFile pubSettingsFile
          let pubClient = PubSettingsClient.Activate pubSettings.Subscriptions
          let client = pubClient.GetClientByIdOrDefault(?id = Subscription) 
          let! clusters = Clusters.getRunningMBraceClusters client
          return clusters |> List.map (sprintf "%+A")
      }