Install issue on Azure AD joined machine

Hi, I am unable to install Powershell Universal on Azure AD Registered devices.

I have tried a clean install of a Windows 11 machine (creating just a local account, not using any windows accounts for the login)
This scenario works fine, and I am able to install any version of the Universal Powershell.

If I during the installation, select to log in with my Azure AD account, the installation will fail on my machines. (tried two different tenants)
(Local account created on the machine, will not work for installation after the machine has been added to Azure AD)

If I check my application errors after the installation has started, I have the following error:

Index : 160606

EntryType : Error

InstanceId : 1026

Message : Application: Universal.Server.exe

                 CoreCLR Version: 6.0.422.16404

                 .NET Version: 6.0.4

                 Description: The process was terminated due to an unhandled exception.

                 Exception Info: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

                    at Microsoft.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)

                    at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)

                    at Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)

                    at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString)

                    at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)

                    at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)

                    at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)

                    at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value)

                    at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection()

                    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()

                    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass18_0.<Exists>b__0(DateTime giveUp)

                    at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_0`2.<Execute>b__0(DbContext c, TState s)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)

                    at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func`2 operation, Func`2 verifySucceeded)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists()

                    at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()

                    at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)

                    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)

                    at PowerShellUniversal.SQL.DatabaseFeature.InitializeDatabase(IConfiguration configuration) in D:\a\universal\universal\src\PowerShellUniversal.SQL\Plugin.cs:line 51

                    at Universal.Server.Services.PluginService..ctor(IConfiguration configuration) in D:\a\universal\universal\src\Universal.Server\Services\PluginService.cs:line 73

                    at Universal.Server.Startup.ConfigureServices(IServiceCollection services) in D:\a\universal\universal\src\Universal.Server\Startup.cs:line 62

                    at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)

                    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

                    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)

                    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)

                    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)

                    at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)

                    at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)

                    at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)

                    at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()

                    at Microsoft.Extensions.Hosting.HostBuilder.Build()

                    at Universal.Server.Program.<>c__DisplayClass3_0.<Main>b__0(Options o) in D:\a\universal\universal\src\Universal.Server\Program.cs:line 69

                    at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)

                    at Universal.Server.Program.Main(String[] args) in D:\a\universal\universal\src\Universal.Server\Program.cs:line 51

Category : (0)

CategoryNumber : 0

ReplacementStrings : {Application: Universal.Server.exe

                 CoreCLR Version: 6.0.422.16404

                 .NET Version: 6.0.4

                 Description: The process was terminated due to an unhandled exception.

                 Exception Info: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

                    at Microsoft.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)

                    at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)

                    at Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)

                    at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString)

                    at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)

                    at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)

                    at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)

                    at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value)

                    at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection()

                    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()

                    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass18_0.<Exists>b__0(DateTime giveUp)

                    at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_0`2.<Execute>b__0(DbContext c, TState s)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)

                    at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func`2 operation, Func`2 verifySucceeded)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists)

                    at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists()

                    at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()

                    at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)

                    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)

                    at PowerShellUniversal.SQL.DatabaseFeature.InitializeDatabase(IConfiguration configuration) in D:\a\universal\universal\src\PowerShellUniversal.SQL\Plugin.cs:line 51

This can be reproduced every time I create a new win 11 machine and join it with Azure AD.

Has anyone been able to install it on Azure AD joined devices, if so, are there any special policies that the intune has to configure? (Log on as a service permission has been tried)

Product: PowerShell Universal
Version: 1.4.6

Tried to do similar to this cleanup but still have same issue.
Can’t install PowerShell Universal · Issue #1163 · ironmansoftware/issues (github.com)

I assume you are using v3 beta and SQL. Can you share what your connection string looks like?

I have tried V3 and SQL yes, have not set up any connection string, as it fails during the initial setup (do not see where I can set up a connection string in the setup wizard?), this is on a clean installed vm, only joined to Azure.

On the other side, if I try other versions, after a clean machine is set up, joined to Azure, it works if I install it before any intune policies have made too big progress on the machine, but if I wait a while, I cannot install any version (happening on two different machines and tenants). I’ll do some more testing.

The connection string configuration should be presented while walking through the MSI.

This is from the latest v3 nightly.

image

Yes, I see the Connection String, I have just the default value in there, but either way, its an issue with the machine here I suspect, old values from old versions still in the system. I’ll just use docker for my use for now :slight_smile:

1 Like

It was indeed some old values in various folders that was the issue, from an earlier installation. After renaming / removing these, the installation went through on my old machine again. (%appdata%)

SQL installation of version 3.0 the latest release now worked fine after the folders were cleaned up.