Example #1
0
        private static IOrganizationService CreateService()
        {
            ClientCredentials Credentials        = new ClientCredentials();
            ClientCredentials devivceCredentials = new ClientCredentials();

            Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

            //This URL needs to be updated to match the servername and Organization for the environment.

            //The following URLs should be used to access the Organization service(SOAP endpoint):
            //https://{Organization Name}.api.crm.dynamics.com/XrmServices/2011/Organization.svc (North America)
            //https://{Organization Name}.api.crm4.dynamics.com/XrmServices/2011/Organization.svc (EMEA)
            //https://{Organization Name}.api.crm5.dynamics.com/XrmServices/2011/Organization.svc (APAC)

            Uri OrganizationUri = new Uri("https://unizap.api.crm5.dynamics.com/XRMServices/2011/Organization.svc");  //Here I am using APAC.

            Uri HomeRealmUri = null;

            //To get device id and password.
            //Online: For online version, we need to call this method to get device id.
            devivceCredentials = DeviceIdManager.LoadDeviceCredentials();

            using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, devivceCredentials))
            {
                serviceProxy.ClientCredentials.UserName.UserName = "******"; // Your Online username.Eg:[email protected]";
                serviceProxy.ClientCredentials.UserName.Password = "******";          //Your Online password
                serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
                _service = (IOrganizationService)serviceProxy;
            }
            return(_service);
        }
        private void btnGo_Click(object sender, RoutedEventArgs e)
        {
            var progress = new ProgressDialog
            {
                Title         = "Connect to Microsoft Dynamics CRM Server",
                Indeterminate = true,
                CaptionText   = "Retrieving authentication settings...",
                Owner         = (NavigationWindow)Parent
            };

            var worker = new BackgroundWorker {
                WorkerReportsProgress = true, WorkerSupportsCancellation = true
            };

            progress.Cancel += GetCancel(worker);

            worker.DoWork += (s, args) =>
            {
                Uri uri;

                if (Uri.TryCreate(args.Argument as string, UriKind.Absolute, out uri))
                {
                    var config = CreateServiceConfiguration(uri);

                    if (config != null)
                    {
                        Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                        {
                            _connectionData.AuthenticationType = (AuthenticationTypeCode)(int)config.AuthenticationType;

                            _connectionData.IntegratedEnabled = config.AuthenticationType == AuthenticationProviderType.ActiveDirectory;
                            _connectionData.Domain            = string.Empty;
                            _connectionData.Username          = string.Empty;
                            _connectionData.FormPassword      = string.Empty;

                            if (config.AuthenticationType == AuthenticationProviderType.LiveId)
                            {
                                var deviceCredentials = DeviceIdManager.LoadDeviceCredentials();

                                if (deviceCredentials != null)
                                {
                                    var deviceId             = deviceCredentials.UserName.UserName ?? string.Empty;
                                    _connectionData.DeviceId = deviceId.StartsWith(DeviceIdManager.DevicePrefix) & deviceId.Length > DeviceIdManager.MaxDeviceNameLength
                                                                                ? deviceId.Substring(DeviceIdManager.DevicePrefix.Length)
                                                                                : deviceId;
                                    _connectionData.DevicePassword = deviceCredentials.UserName.Password ?? string.Empty;
                                }
                            }
                        }));
                    }
                }
            };

            worker.RunWorkerCompleted += GetWorkerCompleted(progress, "Failed to retrieve authentication settings.");

            worker.RunWorkerAsync(txtServerUrl.Text);

            progress.ShowDialog();
        }
Example #3
0
        public string GetDiscoveryCrmConnectionString()
        {
            //var connectionString = string.Format("Url={0}://{1}:{2};",
            //    UseSsl ? "https" : "http",
            //    UseIfd ? ServerName : UseOsdp ? "disco." + ServerName : UseOnline ? "" + ServerName : ServerName,
            //    ServerPort.Length == 0 ? (UseSsl ? 443 : 80) : int.Parse(ServerPort));
            var connectionString = string.Format("Url={0}://{1};",
                                                 UseSsl ? "https" : "http",
                                                 UseIfd ? ServerName : UseOsdp ? "disco." + ServerName : UseOnline ? "" + ServerName : ServerName);

            if (IsCustomAuth)
            {
                if (!UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        connectionString += string.Format("Domain={0};", UserDomain);
                    }
                }

                string username = UserName;
                if (UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        username = string.Format("{0}\\{1}", UserDomain, UserName);
                    }
                }

                connectionString += string.Format("Username={0};Password={1};", username, UserPassword);
            }

            if (UseOnline && !UseOsdp)
            {
                ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIfd && !string.IsNullOrEmpty(HomeRealmUrl))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealmUrl);
            }

            return(connectionString);
        }
Example #4
0
        public string GetDiscoveryCrmConnectionString()
        {
            var connectionString = string.Format("Url={0}://{1}:{2};",
                                                 UseSSL ? "https" : "http",
                                                 UseIFD ? ServerName : UseOffice365 ? "disco." + ServerName : UseOnline ? "dev." + ServerName : ServerName,
                                                 ServerPort.Length == 0 ? (UseSSL ? 443 : 80) : int.Parse(ServerPort));

            if (!UseWindowsAuth)
            {
                if (!UseIFD)
                {
                    if (!string.IsNullOrEmpty(Domain))
                    {
                        connectionString += string.Format("Domain={0};", Domain);
                    }
                }

                string sUsername = Username;
                if (UseIFD)
                {
                    if (!string.IsNullOrEmpty(Domain))
                    {
                        sUsername = string.Format("{0}\\{1}", Domain, Username);
                    }
                }

                connectionString += string.Format("Username={0};Password={1};", sUsername, Password);
            }

            if (UseOnline && !UseOffice365)
            {
                System.ServiceModel.Description.ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIFD && !string.IsNullOrEmpty(HomeRealm))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealm);
            }

            return(connectionString);
        }
        public static OrganizationServiceProxy GetOrganizationServiceProxy(ConnectionDetail detail)
        {
            var    serviceUrl   = detail.OrganizationServiceUrl;
            string homeRealmUrl = null;

            ClientCredentials clientCredentials = new ClientCredentials();
            ClientCredentials deviceCredentials = null;

            if (detail.IsCustomAuth)
            {
                string username = detail.UserName;
                if (!string.IsNullOrEmpty(detail.UserDomain))
                {
                    username = $"{detail.UserDomain}\\{detail.UserName}";
                }
                clientCredentials.UserName.UserName = username;
                clientCredentials.UserName.Password = detail.UserPassword;
            }

            if (detail.UseOnline && !detail.UseOsdp)
            {
                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));
            }

            if (detail.UseIfd && !string.IsNullOrEmpty(detail.HomeRealmUrl))
            {
                homeRealmUrl = detail.HomeRealmUrl;
            }

            Uri serviceUri   = new Uri(serviceUrl);
            Uri homeRealmUri = homeRealmUrl == null ? null : Uri.IsWellFormedUriString(homeRealmUrl, UriKind.RelativeOrAbsolute) ? new Uri(homeRealmUrl) : null;

            return(new OrganizationServiceProxy(serviceUri, homeRealmUri, clientCredentials, deviceCredentials));
        }
        public string GetOrganizationCrmConnectionString()
        {
            var currentServerName = string.Empty;

            if (UseOsdp || UseOnline)
            {
                currentServerName = string.Format("{0}.{1}", OrganizationUrlName, ServerName);
            }
            else if (UseIfd)
            {
                var serverNameParts = ServerName.Split('.');

                serverNameParts[0] = OrganizationUrlName;


                currentServerName = string.Format("{0}:{1}",
                                                  string.Join(".", serverNameParts),
                                                  ServerPort == 0 ? (UseSsl ? 443 : 80) : ServerPort);
            }
            else
            {
                currentServerName = string.Format("{0}:{1}/{2}",
                                                  ServerName,
                                                  ServerPort == 0 ? (UseSsl ? 443 : 80) : ServerPort,
                                                  Organization);
            }

            //var connectionString = string.Format("Url={0}://{1};",
            //                                     UseSsl ? "https" : "http",
            //                                     currentServerName);

            var connectionString = string.Format("Url={0};", OrganizationServiceUrl.Replace("/XRMServices/2011/Organization.svc", ""));

            if (IsCustomAuth)
            {
                if (!UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        connectionString += string.Format("Domain={0};", UserDomain);
                    }
                }

                string username = UserName;
                if (UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        username = string.Format("{0}\\{1}", UserDomain, UserName);
                    }
                }

                connectionString += string.Format("Username={0};Password={1};", username, UserPassword);
            }

            if (UseOnline)
            {
                ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIfd && !string.IsNullOrEmpty(HomeRealmUrl))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealmUrl);
            }

            //append timeout in seconds to connectionstring
            connectionString += string.Format("Timeout={0};", Timeout.ToString(@"hh\:mm\:ss"));
            return(connectionString);
        }
Example #7
0
        public static OrganizationDetailCollection GetOrganizations(Settings settings)
        {
            try
            {
                //System.Windows.MessageBox.Show(typeof(GuidList).Assembly.Location);
                string DiscoveryUrl = string.Format("{0}://{1}:{2}/XRMServices/2011/Discovery.svc",
                                                    settings.UseSSL ? "https" : "http",
                                                    settings.UseIFD ? settings.ServerName : settings.UseOffice365 ? "disco." + settings.ServerName : settings.UseOnline ? "dev." + settings.ServerName : settings.ServerName,
                                                    settings.ServerPort.Length == 0 ? (settings.UseSSL ? 443 : 80) : int.Parse(settings.ServerPort));
                string            domain            = null;
                string            login             = settings.Username;
                ClientCredentials deviceCredentials = null;
                Uri homeRealm = null;
                if (!settings.UseWindowsAuth)
                {
                    if (!settings.UseIFD)
                    {
                        if (!string.IsNullOrEmpty(settings.Domain))
                        {
                            domain = settings.Domain;
                            //connectionString += string.Format("Domain={0};", settings.Domain);
                        }
                    }

                    string sUsername = settings.Username;
                    if (settings.UseIFD)
                    {
                        if (!string.IsNullOrEmpty(settings.Domain))
                        {
                            // sUsername = string.Format("{0}\\{1}", settings.Domain, settings.Username);
                            login = string.Format("{0}\\{1}", settings.Domain, settings.Username);
                        }
                    }
                }

                if (settings.UseOnline && !settings.UseOffice365)
                {
                    do
                    {
                        deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                            DeviceIdManager.RegisterDevice();
                    } while (deviceCredentials.UserName.Password.Contains(";") ||
                             deviceCredentials.UserName.Password.Contains("=") ||
                             deviceCredentials.UserName.Password.Contains(" ") ||
                             deviceCredentials.UserName.UserName.Contains(";") ||
                             deviceCredentials.UserName.UserName.Contains("=") ||
                             deviceCredentials.UserName.UserName.Contains(" "));

                    //connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                    //                                  deviceCredentials.UserName.UserName,
                    //                                  deviceCredentials.UserName.Password);
                }

                if (settings.UseIFD && !string.IsNullOrEmpty(settings.HomeRealm))
                {
                    //connectionString += string.Format("HomeRealmUri={0};", settings.HomeRealm);
                    homeRealm = new Uri(settings.HomeRealm);
                }
                NetworkCredential userCredentials;
                if (!string.IsNullOrWhiteSpace(domain))
                {
                    userCredentials = new NetworkCredential(login, settings.Password, domain);
                }
                else if (settings.UseWindowsAuth)
                {
                    userCredentials = CredentialCache.DefaultNetworkCredentials;
                }
                else
                {
                    userCredentials = new NetworkCredential(login, settings.Password);
                }
                if (settings.UseOnline && settings.UseOffice365)
                {
                    ClientCredentials client = new ClientCredentials();
                    client.UserName.UserName = login;
                    client.UserName.Password = settings.Password;
                    return(CrmServiceClient.DiscoverOrganizations(new Uri(DiscoveryUrl), homeRealm, client, null));
                    //return CrmServiceClient.DiscoverOrganizations(new Uri("https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svc"), homeRealm, client, null);
                }
                if (deviceCredentials == null)
                {
                    return(CrmServiceClient.DiscoverOrganizations(new Uri(DiscoveryUrl), homeRealm, userCredentials));
                }
                else
                {
                    return(CrmServiceClient.DiscoverOrganizations(new Uri(DiscoveryUrl), homeRealm, null, deviceCredentials));
                }

                // var connection = new CrmServiceClient(settings.GetDiscoveryCrmConnectionString());

                //CrmServiceClient.DiscoverOrganizations()

                // var request = new RetrieveOrganizationsRequest();
                // var response = (Microsoft.Xrm.Sdk.Discovery.RetrieveOrganizationsResponse)service.Execute(request);
                // return connection.DiscoverOrganizations();
            }
            catch (System.IO.FileNotFoundException e)
            {
                if (e.Message.Contains("Microsoft.IdentityModel"))
                {
                    throw new Exception("Unable to load Windows Identity Foundation 3.5.  This is a feature that can be enabled on windows 8+ or downloaded for earlier versions ->  https://www.microsoft.com/en-nz/download/details.aspx?id=17331 ", e);
                }
                else
                {
                    throw e;
                }
            }
        }
Example #8
0
        public string GetOrganizationCrmConnectionString()
        {
            var currentServerName = string.Empty;

            var orgDetails = ConnectionHelper.GetOrganizationDetails(this);

            if (UseOffice365 || UseOnline)
            {
                currentServerName = string.Format("{0}.{1}", orgDetails.UrlName, ServerName);
            }
            else if (UseIFD)
            {
                var serverNameParts = ServerName.Split('.');

                serverNameParts[0] = orgDetails.UrlName;


                currentServerName = string.Format("{0}:{1}",
                                                  string.Join(".", serverNameParts),
                                                  ServerPort.Length == 0 ? (UseSSL ? 443 : 80) : int.Parse(ServerPort));
            }
            else
            {
                currentServerName = string.Format("{0}:{1}/{2}",
                                                  ServerName,
                                                  ServerPort.Length == 0 ? (UseSSL ? 443 : 80) : int.Parse(ServerPort),
                                                  CrmOrg);
            }

            //var connectionString = string.Format("Url={0}://{1};",
            //                                     UseSSL ? "https" : "http",
            //                                     currentServerName);

            var connectionString = string.Format("Url={0};", orgDetails.Endpoints[EndpointType.OrganizationService].Replace("/XRMServices/2011/Organization.svc", ""));

            if (!UseWindowsAuth)
            {
                if (!UseIFD)
                {
                    if (!string.IsNullOrEmpty(Domain))
                    {
                        connectionString += string.Format("Domain={0};", Domain);
                    }
                }

                string username = Username;
                if (UseIFD)
                {
                    if (!string.IsNullOrEmpty(Domain))
                    {
                        username = string.Format("{0}\\{1}", Domain, Username);
                    }
                }

                connectionString += string.Format("Username={0};Password={1};", username, Password);
            }

            if (UseOnline)
            {
                System.ServiceModel.Description.ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIFD && !string.IsNullOrEmpty(HomeRealm))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealm);
            }

            //append timeout in seconds to connectionstring
            //connectionString += string.Format("Timeout={0};", Timeout.ToString(@"hh\:mm\:ss"));
            return(connectionString);
        }
Example #9
0
        private string GetOrganizationCrmConnectionString()
        {
            var connectionString = string.Format("Url={0};", OrganizationServiceUrl.Replace("/XRMServices/2011/Organization.svc", ""));

            if (IsCustomAuth)
            {
                if (!UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        connectionString += string.Format("Domain={0};", UserDomain);
                    }
                }

                string username = UserName;
                if (UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        username = string.Format("{0}\\{1}", UserDomain, UserName);
                    }
                }

                if (string.IsNullOrEmpty(userPassword))
                {
                    throw new Exception("User password cannot be null. If the user password is not stored in configuration file, you should request it from the end user");
                }

                var decryptedPassword = CryptoManager.Decrypt(userPassword, ConnectionManager.CryptoPassPhrase,
                                                              ConnectionManager.CryptoSaltValue,
                                                              ConnectionManager.CryptoHashAlgorythm,
                                                              ConnectionManager.CryptoPasswordIterations,
                                                              ConnectionManager.CryptoInitVector,
                                                              ConnectionManager.CryptoKeySize);

                connectionString += string.Format("Username={0};Password={1};", username, decryptedPassword);
            }

            if (UseOnline)
            {
                ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIfd && !string.IsNullOrEmpty(HomeRealmUrl))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealmUrl);
            }

            //append timeout in seconds to connectionstring
            connectionString += string.Format("Timeout={0};", Timeout.ToString(@"hh\:mm\:ss"));
            return(connectionString);
        }
Example #10
0
        private string GetDiscoveryCrmConnectionString()
        {
            var connectionString = string.Format("Url={0}://{1}:{2};",
                                                 UseSsl ? "https" : "http",
                                                 UseIfd ? ServerName : UseOsdp ? "disco." + ServerName : UseOnline ? "dev." + ServerName : ServerName,
                                                 ServerPort == 0 ? (UseSsl ? 443 : 80) : ServerPort);

            if (IsCustomAuth)
            {
                if (!UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        connectionString += string.Format("Domain={0};", UserDomain);
                    }
                }

                string username = UserName;
                if (UseIfd)
                {
                    if (!string.IsNullOrEmpty(UserDomain))
                    {
                        username = string.Format("{0}\\{1}", UserDomain, UserName);
                    }
                }

                if (string.IsNullOrEmpty(userPassword))
                {
                    throw new Exception("User password cannot be null. If the user password is not stored in configuration file, you should request it from the end user");
                }

                var decryptedPassword = CryptoManager.Decrypt(userPassword, ConnectionManager.CryptoPassPhrase,
                                                              ConnectionManager.CryptoSaltValue,
                                                              ConnectionManager.CryptoHashAlgorythm,
                                                              ConnectionManager.CryptoPasswordIterations,
                                                              ConnectionManager.CryptoInitVector,
                                                              ConnectionManager.CryptoKeySize);

                connectionString += string.Format("Username={0};Password={1};", username, decryptedPassword);
            }

            if (UseOnline && !UseOsdp)
            {
                ClientCredentials deviceCredentials;

                do
                {
                    deviceCredentials = DeviceIdManager.LoadDeviceCredentials() ??
                                        DeviceIdManager.RegisterDevice();
                } while (deviceCredentials.UserName.Password.Contains(";") ||
                         deviceCredentials.UserName.Password.Contains("=") ||
                         deviceCredentials.UserName.Password.Contains(" ") ||
                         deviceCredentials.UserName.UserName.Contains(";") ||
                         deviceCredentials.UserName.UserName.Contains("=") ||
                         deviceCredentials.UserName.UserName.Contains(" "));

                connectionString += string.Format("DeviceID={0};DevicePassword={1};",
                                                  deviceCredentials.UserName.UserName,
                                                  deviceCredentials.UserName.Password);
            }

            if (UseIfd && !string.IsNullOrEmpty(HomeRealmUrl))
            {
                connectionString += string.Format("HomeRealmUri={0};", HomeRealmUrl);
            }

            return(connectionString);
        }
        public void LoadDeviceCredentialsTest()
        {
            ClientCredentials clientCredentials = DeviceIdManager.LoadDeviceCredentials();

            Assert.IsNotNull(clientCredentials);
        }