SSO Application configuration

SSO Application configuration requires to reduce burden on BizTalk Configuration file, because using BizTalk configuration file some time create problem if any one by mistake update some invalid data then it will not run any BizTalk application. Also, you cannot set up value from BTSConfig in custom pipeline. So, to overcome this issue, there is a tool provided by Microsoft as SSOConfigurationMMCSnapIn along with SSOHelper class file.

below is the link of download SSOConfigurationMMCSnapIn software which you need to install on the system.

https://www.microsoft.com/en-in/download/details.aspx?id=14524

BizTalk 2016 has some issue with SSO Configuration Application MMC Snap-In. So Sandro Pereira has created a new tool BizTalk.Tools.SSOApplicationConfiguration to setup the data. you can download from below reference:

https://gallery.technet.microsoft.com/BizTalk-Server-SSO-e83756f7

For more details you can refer to below reference:

https://blog.sandro-pereira.com/2018/02/09/the-birth-of-a-new-sso-application-configuration-tool-for-biztalk-server-2016/

You need to create a dll file to read the key/value pair from sso configuration. SSOClientHelper.cs file is also available in SSOConfigurationMMCSnapIn downloaded file. If you doesn’t find, then create dll based on below code and gac it. Below code is mentioned in that cs file.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Collections.Specialized;

using Microsoft.BizTalk.SSOClient.Interop;

namespace SSOHelper

{

    public class ConfigurationPropertyBag : IPropertyBag

    {

        private HybridDictionary properties;

        internal ConfigurationPropertyBag()

        {

            properties = new HybridDictionary();

        }

        public void Read(string propName, out object ptrVar, int errLog)

        {

            ptrVar = properties[propName];

        }

        public void Write(string propName, ref object ptrVar)

        {

            properties.Add(propName, ptrVar);

        }

        public bool Contains(string key)

        {

            return properties.Contains(key);

        }

        public void Remove(string key)

        {

            properties.Remove(key);

        }

    }

 

    public static class SSOClientHelper

    {

        private static string idenifierGUID = “ConfigProperties”;

        public static string Read(string appName, string propName)

        {

            try

            {

                SSOConfigStore ssoStore = new SSOConfigStore();

                ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();

                ((ISSOConfigStore)ssoStore).GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag)appMgmtBag);

                object propertyValue = null;

                appMgmtBag.Read(propName, out propertyValue, 0);

                return (string)propertyValue;

            }

            catch (Exception e)

            {

                System.Diagnostics.Trace.WriteLine(e.Message);

                throw;

            }

        }

    }

}

 

Code for reading Key Value data as defiled above

string archiveFilePath = SSOHelper.SSOClientHelper.Read(“ApplicationName”, “KeyName”);

You can use above code template in custom pipeline, orchestration or any other BizTalk components.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s