Connect-AzAccount ServicePrincipalCertificateWithSubscriptionId Parameter Set errors with Parameter name: secureString value cannot be null
Description
When running the Connect-AzAccount Cmdlet with the ServicePrincipalCertificateWithSubscriptionId Parameter Set on Ubuntu 16.04, I am unable to connect because of the error:
Connect-AzAccount : Value cannot be null.
Parameter name: secureString
Looking at the help and the code, the secureString is type for the Parameter ManagedServiceSecret of the ManagedServiceParameterSet.
Script/Steps for Reproduction
$ApplicationId = 'xxxx-xxxx-xxxx'
$TenantId = 'xxxx-xxxx-xxxx'
$CertThumbprint = 'xxxx-xxxx-xxxx'
Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -CertificateThumbprint $CertThumbprint -ServicePrincipal
or
Connect-AzAccount -CertificateThumbprint 'xxxx'
cmdlet Connect-AzAccount at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
ApplicationId: xxxx
Tenant: xxxx
Connect-AzAccount : Value cannot be null.
Parameter name: secureString
At line:1 char:1
+ Connect-AzAccount -CertificateThumbprint 'xxxx'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
Module Version
Get-Module -ListAvailable
Directory: /home/agent/.local/share/powershell/Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Script 0.5.0 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script 0.5.0 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServ...
Script 0.5.0 Az.ApiManagement Core,Desk {Add-AzApiManagementRegion, Get-AzApiManagementSsoToken, New-AzApiManagementHostnameCo...
Script 0.5.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, S...
Script 0.5.0 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomati...
Script 0.5.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKeys, New-AzBatchAccount...
Script 0.5.0 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount}
Script 0.5.0 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script 0.5.0 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveSer...
Script 0.5.0 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvai...
Script 0.5.0 Az.Consumption Core,Desk {Get-AzConsumptionBudget, Get-AzConsumptionMarketplace, Get-AzConsumptionPriceSheet, G...
Script 0.5.0 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerI...
Script 0.5.0 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-...
Script 0.5.0 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-A...
Script 0.5.0 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove...
Script 0.5.0 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy,...
Script 0.5.0 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script 0.5.0 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopi...
Script 0.5.0 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzE...
Script 0.5.0 Az.Insights Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script 0.5.0 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get...
Script 0.5.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOp...
Script 0.5.0 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountCallbackUrl, Get-AzIntegra...
Script 0.5.0 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlan...
Script 0.5.0 Az.MachineLearningCompute Core,Desk {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-AzMlOpClusterSystemServicesUpdateAvaila...
Script 0.5.0 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 0.5.0 Az.Media Core,Desk {Sync-AzMediaServiceStorageKeys, Set-AzMediaServiceKey, Get-AzMediaServiceKeys, Get-Az...
Script 0.5.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthentica...
Script 0.5.0 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRules, Get-AzNotificationHub...
Script 0.5.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomL...
Script 0.5.0 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediati...
Script 0.5.0 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIW...
Script 0.5.0 Az.Profile Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-...
Script 0.5.0 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServ...
Script 0.5.0 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatc...
Script 0.5.0 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNames...
Script 0.5.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAss...
Script 0.5.0 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remo...
Script 0.5.0 Az.ServiceFabric Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-...
Script 0.5.0 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script 0.5.1 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptio...
Script 0.5.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAcc...
Script 0.5.0 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-Az...
Script 0.5.0 Az.Tags Core,Desk {Remove-AzTag, Get-AzTag, New-AzTag}
Script 0.5.0 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEn...
Script 0.5.0 Az.UsageAggregates Core,Desk Get-UsageAggregates
Script 0.5.0 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppService...
Directory: /opt/microsoft/powershell/6/Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Manifest 1.2.2.0 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive}
Manifest 6.1.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}
Manifest 6.1.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Manifest 6.1.0.0 Microsoft.PowerShell.Security Core {Get-Credential, Get-ExecutionPolicy, Set-ExecutionPolicy, ConvertFrom-SecureString...}
Manifest 6.1.0.0 Microsoft.PowerShell.Utility Core {Format-List, Format-Custom, Format-Table, Format-Wide...}
Script 1.1.7.2 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script 1.6.7 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script 0.0 PSDesiredStateConfiguration Desk {ConvertTo-MOFInstance, Get-PSTopConfigurationName, GetImplementingModulePath, Write-N...
Script 2.0.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-...
Binary 1.1.2 ThreadJob Desk Start-ThreadJob
Environment Data
$PSVersionTable
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Linux 4.15.0-1025-azure #26~16.04.1-Ubuntu SMP Tue Sep 25 11:09:50 UTC 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Debug Output
DEBUG: 10:00:21 PM - ConnectAzureRmAccountCommand begin processing with ParameterSet 'ServicePrincipalCertificateWithSubscriptionId'.
Connect-AzAccount : Value cannot be null.
Parameter name: secureString
At line:1 char:1
+ Connect-AzAccount -ApplicationId 'xxxx-xxx-xxxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
DEBUG: AzureQoSEvent: CommandName - Connect-AzAccount; IsSuccess - False; Duration - 00:00:00.0158353; Exception - System.ArgumentNullException: Value cannot be null.
Parameter name: secureString
at Microsoft.WindowsAzure.Commands.Common.SecureStringExtensions.ConvertToString(SecureString secureString)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 10:00:21 PM - ConnectAzureRmAccountCommand end processing.
DEBUG: 10:00:21 PM - ConnectAzureRmAccountCommand end processing.
Cheers!
@MatthewJDavis Hey Matthew, we will be releasing version 0.6.0 of the Az module tomorrow (2018-11-20), which should enable certificate authentication. Would you mind installing the new version of the module when it's released and verifying that it fixes the issue you are seeing?
@cormacpayne Hi Cormac, will do. I'll report back once I've updated and tested. Cheers.
@cormacpayne Hello Cormac,
I've installed the latest version 0.6.1 today on Ubuntu and get a new error, possibly with the way dotnet core handles certificates on linux from what I've read.
Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores.
I've tested on a Windows installation and that is working and authenticating to Azure with a service principal and certificate so have included that output too for reference.
Let me know if you need anything else tested or information.
Cheers.
Ubuntu - X509Store Error
Script/Steps for Reproduction
Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -CertificateThumbprint $CertThumbprint -ServicePrincipal -Force
Connect-AzAccount : Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores.
At line:1 char:1
+ Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -Ce ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], CryptographicException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
PowerShell Version
PS /home> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Linux 4.4.0-17134-Microsoft #345-Microsoft Wed Sep 19 17:47:00 PST 2018
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Environment Data
get-module -ListAvailable
Directory: /usr/local/share/powershell/Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Script 0.6.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAk...
Script 0.6.1 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnal...
Script 0.6.1 Az.ApiManagement Core,Desk {Add-AzApiManagementRegion, Get-AzApiManagementS...
Script 0.6.1 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationIns...
Script 0.6.1 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAut...
Script 0.6.1 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-...
Script 0.6.1 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-...
Script 0.6.1 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-A...
Script 0.6.1 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitive...
Script 0.6.1 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet...
Script 0.6.1 Az.Consumption Core,Desk {Get-AzConsumptionBudget, Get-AzConsumptionMarke...
Script 0.6.1 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Rem...
Script 0.6.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistr...
Script 0.6.1 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLa...
Script 0.6.1 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-Az...
Script 0.6.1 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShu...
Script 0.6.1 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remo...
Script 0.6.1 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set...
Script 0.6.1 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHubNamespac...
Script 0.6.1 Az.Insights Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-Az...
Script 0.6.1 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGr...
Script 0.6.1 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCer...
Script 0.6.1 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegr...
Script 0.6.1 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitm...
Script 0.6.1 Az.MachineLearningCompute Core,Desk {Get-AzMlOpCluster, Get-AzMlOpClusterKey, Test-A...
Script 0.6.1 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 0.6.1 Az.Media Core,Desk {Sync-AzMediaServiceStorageKeys, Set-AzMediaServ...
Script 0.6.1 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertifica...
Script 0.6.1 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAut...
Script 0.6.1 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSo...
Script 0.6.1 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPol...
Script 0.6.1 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowe...
Script 0.6.1 Az.Profile Core,Desk {Disable-AzDataCollection, Disable-AzContextAuto...
Script 0.6.1 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRec...
Script 0.6.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCa...
Script 0.6.1 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set...
Script 0.6.1 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignmen...
Script 0.6.1 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusName...
Script 0.6.1 Az.ServiceFabric Core,Desk {Add-AzServiceFabricApplicationCertificate, Add-...
Script 0.6.1 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey,...
Script 0.6.1 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get...
Script 0.6.1 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, ...
Script 0.6.1 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnal...
Script 0.6.1 Az.Tags Core,Desk {Remove-AzTag, Get-AzTag, New-AzTag}
Script 0.6.1 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Rem...
Script 0.6.1 Az.UsageAggregates Core,Desk Get-UsageAggregates
Script 0.6.1 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New...
Directory: /opt/microsoft/powershell/6/Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Manifest 1.2.2.0 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive}
Manifest 6.1.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}
Manifest 6.1.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Clear-ItemProperty,...
Manifest 6.1.0.0 Microsoft.PowerShell.Security Core {Get-Credential, Get-ExecutionPolicy, Set-Execut...
Manifest 6.1.0.0 Microsoft.PowerShell.Utility Core {Format-List, Format-Custom, Format-Table, Forma...
Script 1.1.7.2 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider,...
Script 1.6.7 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Fi...
Script 0.0 PSDesiredStateConfiguration Desk {IsPatternMatched, Get-MofInstanceText, Set-PSDe...
Script 2.0.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHand...
Binary 1.1.2 ThreadJob Desk Start-ThreadJob
Debug Output
Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -CertificateThumbprint $CertThumbprint -ServicePrincipal -Force
DEBUG: 02:25:34 - ConnectAzureRmAccountCommand begin processing with ParameterSet 'ServicePrincipalCertificateWithSubscriptionId'.
DEBUG: 02:25:34 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 02:25:34 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 02:25:34 - Using Autosave scope 'CurrentUser'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '65d6a2c3-6dcd-476e-82a4-12c230cf80b5', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthrity: 'True'
Connect-AzAccount : Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores.
At line:1 char:2
+ Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzAccount], CryptographicException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
DEBUG: AzureQoSEvent: CommandName - Connect-AzAccount; IsSuccess - False; Duration - 00:00:00.0268340; Exception - System.Security.Cryptography.CryptographicException: Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores. ---> System.PlatformNotSupportedException: Unix LocalMachine X509Store is limited to the Root and CertificateAuthority stores.
--- End of inner exception stack trace ---
at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
at Microsoft.Azure.Commands.Common.Authentication.Abstractions.DiskDataStore.<>c__DisplayClass22_0.<TryFindCertificatesInStore>b__0(X509Store store)
at Microsoft.Azure.Commands.Common.Authentication.Abstractions.DiskDataStore.X509StoreWrapper(StoreName storeName, StoreLocation storeLocation, Action`1 action)
at Microsoft.Azure.Commands.Common.Authentication.Abstractions.DiskDataStore.TryFindCertificatesInStore(String thumbprint, StoreLocation location, X509Certificate2Collection& certificates)
at Microsoft.Azure.Commands.Common.Authentication.Abstractions.DiskDataStore.GetCertificate(String thumbprint)
at Microsoft.Azure.Commands.Common.Authentication.ServicePrincipalTokenProvider.AcquireTokenWithCertificate(AdalConfiguration config, String appId, String thumbprint)
at Microsoft.Azure.Commands.Common.Authentication.ServicePrincipalTokenProvider.GetAccessTokenWithCertificate(AdalConfiguration config, String clientId, String certificateThumbprint, String credentialType)
at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, String promptBehavior, Action`1 promptAction, IAzureTokenCache tokenCache, String resourceId)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String promptBehavior, Action`1 promptAction)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantId, String subscriptionId, String subscriptionName, SecureString password, Boolean skipValidation, Action`1 promptAction, String name, Boolean shouldPopulateContextList)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass87_0.<ExecuteCmdlet>b__0(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 02:25:35 - ConnectAzureRmAccountCommand end processing.
DEBUG: 02:25:35 - ConnectAzureRmAccountCommand end processing.
Windows - PowerShell Core - Working OK
Script/Steps for Reproduction
Connect-AzAccount -ApplicationId $ApplicationId -Tenant $TenantId -CertificateThumbprint $CertThumbprint -ServicePrincipal
Environments
------------
{[AzureUSGovernment, AzureUSGovernment], [AzureChinaCloud, AzureChinaCloud], [AzureGermanCloud, AzureGerman...
PS C:\Users\Matt\Downloads\PowerShell-6.1.1-win-x64> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.1
PSEdition Core
GitCommitId 6.1.1
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Environment Data
get-module -ListAvailable
Directory: C:\Program Files\PowerShell\Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Script 0.6.1 Az.Aks Core,Desk {Get-AzAks, New-AzAks, Remove-AzAks, Im... Script 0.6.1 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspe... Script 0.6.1 Az.ApiManagement Core,Desk {Add-AzApiManagementRegion, Get-AzApiMa... Script 0.6.1 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzAppli... Script 0.6.1 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Rem... Script 0.6.1 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAcco... Script 0.6.1 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPer... Script 0.6.1 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoU... Script 0.6.1 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-Az... Script 0.6.1 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvaila... Script 0.6.1 Az.Consumption Core,Desk {Get-AzConsumptionBudget, Get-AzConsump... Script 0.6.1 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerG... Script 0.6.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContain... Script 0.6.1 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New... Script 0.6.1 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, ... Script 0.6.1 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzD... Script 0.6.1 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordCon... Script 0.6.1 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridT... Script 0.6.1 Az.EventHub Core,Desk {New-AzEventHubNamespace, Get-AzEventHu... Script 0.6.1 Az.Insights Core,Desk {Get-AzMetricDefinition, Get-AzMetric, ... Script 0.6.1 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubC... Script 0.6.1 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKe... Script 0.6.1 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get... Script 0.6.1 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-Az... Script 0.6.1 Az.MachineLearningCompute Core,Desk {Get-AzMlOpCluster, Get-AzMlOpClusterKe... Script 0.6.1 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketpl... Script 0.6.1 Az.Media Core,Desk {Sync-AzMediaServiceStorageKeys, Set-Az... Script 0.6.1 Az.Network Core,Desk {Add-AzApplicationGatewayAuthentication... Script 0.6.1 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificat... Script 0.6.1 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivity... Script 0.6.1 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, ... Script 0.6.1 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, G... Script 0.6.1 Az.Profile Core,Desk {Disable-AzDataCollection, Disable-AzCo... Script 0.6.1 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, ... Script 0.6.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-... Script 0.6.1 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNames... Script 0.6.1 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRole... Script 0.6.1 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServi... Script 0.6.1 Az.ServiceFabric Core,Desk {Add-AzServiceFabricApplicationCertific... Script 0.6.1 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSi... Script 0.6.1 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryp... Script 0.6.1 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAcc... Script 0.6.1 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzS... Script 0.6.1 Az.Tags Core,Desk {Remove-AzTag, Get-AzTag, New-AzTag}
Script 0.6.1 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndp... Script 0.6.1 Az.UsageAggregates Core,Desk Get-UsageAggregates
Script 0.6.1 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppService...
Directory: C:\users\matt\downloads\powershell-6.1.1-win-x64\Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Manifest 6.1.0.0 CimCmdlets Core {Get-CimAssociatedInstance, Get-CimClas... Manifest 1.2.2.0 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive}
Manifest 6.1.0.0 Microsoft.PowerShell.Diagnostics Core {Get-WinEvent, New-WinEvent}
Manifest 6.1.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}
Manifest 6.1.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Clear-Item... Manifest 6.1.0.0 Microsoft.PowerShell.Security Core {Get-Acl, Set-Acl, Get-PfxCertificate, ... Manifest 6.1.0.0 Microsoft.PowerShell.Utility Core {Format-List, Format-Custom, Format-Tab... Manifest 6.1.0.0 Microsoft.WSMan.Management Core {Disable-WSManCredSSP, Enable-WSManCred... Script 1.1.7.2 PackageManagement Desk {Find-Package, Get-Package, Get-Package... Script 1.6.7 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-M... Script 0.0 PSDesiredStateConfiguration Desk {Write-MetaConfigFile, Set-NodeResource... Script 6.1.0.0 PSDiagnostics Core {Disable-PSTrace, Disable-PSWSManCombin... Script 2.0.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLi... Binary 1.1.2 ThreadJob Desk Start-ThreadJob
@MatthewJDavis Hey Matthew, thanks for doing the above tests. I'll need to take a look at the Linux scenario, but I do believe you're correct that it's a way with how .NET Core handles certificates on Linux. It appears that you should be unblocked for the Windows scenario, so I'm going to temporarily close this issue, and if I find that the issue for Linux is on our side rather than .NET Core, I will re-open this issue. Please let me know if you have any questions or concerns!