Repository navigation
Closed
Labels
AccountsIssues in Az.Accounts except authentication relatedIssues in Az.Accounts except authentication relatedfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.needs-team-attentionThis issue needs attention from Azure service team or SDK teamThis issue needs attention from Azure service team or SDK team
Description
Description
Connect-AzAccount seems to treat -Identity:$false the same as -Identity (where it should treat it as if it hadn't been specified), resulting in: No connection could be made because the target machine actively refused it.
Steps to reproduce
Execute the following on a machine without Managed Identity support (e.g. your dev machine)
Connect-AzAccount -Identity:$falseEnvironment data
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.19041
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
Directory: C:\Users\ohads\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 4.6.1 Az Core,Desk
Script 4.5.0 Az Core,Desk
Script 1.9.3 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave…}
Script 1.9.2 Az.Accounts Core,Desk {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave…}
Script 1.1.1 Az.Advisor Core,Desk {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Disable-AzAdvisorRecommendation, Get-AzAdviso…
Script 1.2.0 Az.Aks Core,Desk {Get-AzAksCluster, New-AzAksCluster, Remove-AzAksCluster, Import-AzAksCredential…}
Script 1.1.4 Az.AnalysisServices Core,Desk {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-Az…
Script 2.1.0 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-A…
Script 1.1.0 Az.ApplicationInsights Core,Desk {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Update-AzApplicationIn…
Script 1.4.0 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, …
Script 1.3.7 Az.Automation Core,Desk {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, …
Script 3.1.0 Az.Batch Core,Desk {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount…}
Script 1.0.3 Az.Billing Core,Desk {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget…}
Script 1.4.3 Az.Cdn Core,Desk {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile…}
Script 1.5.1 Az.CognitiveServices Core,Desk {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccountSku, Get-…
Script 4.3.1 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet…}
Script 4.2.1 Az.Compute Core,Desk {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet…}
Script 1.0.3 Az.ContainerInstance Core,Desk {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script 1.1.1 Az.ContainerRegistry Core,Desk {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry…}
Script 1.1.0 Az.DataBoxEdge Core,Desk {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzDataBoxEdgeDevice, New-AzDataBoxEdgeDevice…}
Script 1.10.0 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2…}
Script 1.9.0 Az.DataFactory Core,Desk {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2…}
Script 1.0.2 Az.DataLakeAnalytics Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCat…
Script 1.2.8 Az.DataLakeStore Core,Desk {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirew…
Script 1.0.0 Az.DataShare Core,Desk {New-AzDataShareAccount, Get-AzDataShareAccount, Remove-AzDataShareAccount, New-AzDataShare…}
Script 1.1.0 Az.DeploymentManager Core,Desk {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerArtifactSource, Set-AzDeploymentManagerArtif…
Script 1.0.0 Az.DesktopVirtualization Core,Desk {Disconnect-AzWvdUserSession, Get-AzWvdApplication, Get-AzWvdApplicationGroup, Get-AzWvdDesktop…}
Script 1.0.2 Az.DevTestLabs Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPo…
Script 1.1.2 Az.Dns Core,Desk {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet…}
Script 1.3.0 Az.EventGrid Core,Desk {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey…}
Script 1.6.1 Az.FrontDoor Core,Desk {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFrontDoor…}
Script 1.0.1 Az.Functions Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Get-AzFunctionAppPlan, Get-AzFunctionAppSetting…}
Script 3.5.0 Az.HDInsight Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapRed…
Script 3.4.0 Az.HDInsight Core,Desk {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapRed…
Script 1.1.0 Az.HealthcareApis Core,Desk {New-AzHealthcareApisService, Remove-AzHealthcareApisService, Set-AzHealthcareApisService, Get-AzHealthcare…
Script 2.5.0 Az.IotHub Core,Desk {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJob…}
Script 2.1.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVau…
Script 2.0.0 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVau…
Script 1.3.2 Az.LogicApp Core,Desk {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBatchConfigur…
Script 1.1.3 Az.MachineLearning Core,Desk {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistory, Remove-…
Script 1.1.0 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenanceUpdate…}
Script 1.0.0 Az.Maintenance Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenanceUpdate…}
Script 0.7.3 Az.ManagedServiceIdentity Core,Desk {New-AzUserAssignedIdentity, Get-AzUserAssignedIdentity, Remove-AzUserAssignedIdentity}
Script 1.1.0 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, New-AzManagedServicesAssignment, Remove-AzManagedServicesAssignment, Get-…
Script 1.0.2 Az.ManagedServices Core,Desk {Get-AzManagedServicesAssignment, New-AzManagedServicesAssignment, Remove-AzManagedServicesAssignment, Get-…
Script 1.0.2 Az.MarketplaceOrdering Core,Desk {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.1.1 Az.Media Core,Desk {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMediaServiceKey, Get-AzMediaServiceNameAvailab…
Script 2.1.0 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile…}
Script 2.0.2 Az.Monitor Core,Desk {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile…}
Script 3.3.0 Az.Network Core,Desk {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-…
Script 1.1.1 Az.NotificationHubs Core,Desk {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotific…
Script 2.3.0 Az.OperationalInsights Core,Desk {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable…
Script 1.3.1 Az.PolicyInsights Core,Desk {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation…}
Script 1.1.2 Az.PowerBIEmbedded Core,Desk {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAcc…
Script 1.0.3 Az.PrivateDns Core,Desk {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPrivateDnsZone, New-AzPrivateDnsZone…}
Script 2.11.1 Az.RecoveryServices Core,Desk {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSettingsFile…
Script 1.2.1 Az.RedisCache Core,Desk {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedi…
Script 1.0.3 Az.Relay Core,Desk {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace…}
Script 2.5.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment…}
Script 2.4.0 Az.Resources Core,Desk {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment…}
Script 1.4.1 Az.ServiceBus Core,Desk {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamesp…
Script 2.1.0 Az.ServiceFabric Core,Desk {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode, Add-…
Script 1.2.0 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey…}
Script 1.1.1 Az.SignalR Core,Desk {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey…}
Script 2.9.1 Az.Sql Core,Desk {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlD…
Script 1.1.0 Az.SqlVirtualMachine Core,Desk {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM…}
Script 2.5.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey…}
Script 2.4.0 Az.Storage Core,Desk {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey…}
Script 1.3.0 Az.StorageSync Core,Desk {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSyncService, Get-AzStorageSyncService, Set-AzStorageS…
Script 1.0.1 Az.StreamAnalytics Core,Desk {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFuncti…
Script 1.0.0 Az.Support Core,Desk {Get-AzSupportService, Get-AzSupportProblemClassification, Get-AzSupportTicket, Get-AzSupportTicketCommunic…
Script 1.0.4 Az.TrafficManager Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTraffic…
Script 1.11.0 Az.Websites Core,Desk {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan…}
Directory: C:\program files\powershell\7\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Manifest 7.0.0.0 CimCmdlets Core {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession…}
Manifest 1.2.5 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive}
Manifest 7.0.0.0 Microsoft.PowerShell.Diagnostics Core {Get-WinEvent, New-WinEvent, Get-Counter}
Manifest 7.0.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript}
Manifest 7.0.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Get-Clipboard, Set-Clipboard…}
Manifest 7.0.0.0 Microsoft.PowerShell.Security Core {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential…}
Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core {Export-Alias, Get-Alias, Import-Alias, New-Alias…}
Manifest 7.0.0.0 Microsoft.WSMan.Management Core {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig…}
Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script 2.2.4.1 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}
Script 2.0.5 PSDesiredStateConfiguration Core {Configuration, New-DscChecksum, Get-DscResource, Invoke-DscResource}
Script 7.0.0.0 PSDiagnostics Core {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace…}
Script 2.0.2 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…}
Binary 2.0.3 ThreadJob Desk Start-ThreadJob
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.0.1 Microsoft.PowerShell.Operation.Val… Desk {Get-OperationValidation, Invoke-OperationValidation}
Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…}
Script 3.4.0 Pester Desk {Describe, Context, It, Should…}
Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Module, Update-Module…}
Script 2.0.0 beta2 PSReadline Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…}
Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Manifest 1.0.0.0 AppBackgroundTask Core,Desk {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Set-AppBackgroundTaskResour…
Manifest 2.0.1.0 Appx Core,Desk {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage…}
Script 1.0.0.0 AssignedAccess Core,Desk {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}
Manifest 1.0.0.0 BitLocker Core,Desk {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtector…}
Manifest 2.0.0.0 BitsTransfer Core,Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer…}
Manifest 1.0.0.0 BranchCache Core,Desk {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading…}
Manifest 1.0 ConfigDefender Core,Desk {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference…}
Manifest 1.0 Defender Core,Desk {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference…}
Manifest 1.0.2.0 DeliveryOptimization Core,Desk {Delete-DeliveryOptimizationCache, Set-DeliveryOptimizationStatus, Get-DeliveryOptimizationLog, Get-Deliver…
Manifest 1.0.0.0 DirectAccessClientComponents Core,Desk {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DAClientExperienceConfigurati…
Script 3.0 Dism Core,Desk {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability, Add-WindowsImage…}
Manifest 1.0.0.0 DnsClient Core,Desk {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache…}
Manifest 1.0.0.0 EventTracingManagement Core,Desk {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTraceSession…}
Manifest 2.0.0.0 International Core,Desk {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHomeLocation, Set-WinHomeLoca…
Manifest 1.0.0.0 Kds Core,Desk {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration…}
Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics Core,Desk {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter…}
Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts Core,Desk {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup…}
Manifest 3.1.0.0 Microsoft.PowerShell.Management Core,Desk {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path…}
Manifest 1.0 MMAgent Core,Desk {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent…}
Manifest 2.0.0.0 NetAdapter Core,Desk {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload, Disable-NetAdapterEncaps…
Manifest 1.0.0.0 NetConnection Core,Desk {Get-NetConnectionProfile, Set-NetConnectionProfile}
Manifest 1.0.0.0 NetEventPacketCapture Core,Desk {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSession…}
Manifest 2.0.0.0 NetLbfo Core,Desk {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember…}
Manifest 1.0.0.0 NetNat Core,Desk {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession…}
Manifest 2.0.0.0 NetQos Core,Desk {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}
Manifest 2.0.0.0 NetSecurity Core,Desk {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetIPsecQuickModeCry…
Manifest 1.0.0.0 NetSwitchTeam Core,Desk {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam…}
Manifest 1.0.0.0 NetTCPIP Core,Desk {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol…}
Manifest 1.0.0.0 NetworkConnectivityStatus Core,Desk {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguration, Set-NCSIPolicyConfigur…
Manifest 1.0.0.0 NetworkSwitchManager Core,Desk {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-NetworkSwitchEthernetPort, Remove…
Manifest 1.0.0.0 NetworkTransition Core,Desk {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHttpsProfile, Disable-NetNa…
Manifest 1.0.0.0 PcsvDevice Core,Desk {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice…}
Manifest 1.0.0.0 PKI Core,Desk {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate, Get-CertificateAutoEnrol…
Manifest 1.0.0.0 PnpDevice Core,Desk {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}
Manifest 1.1 PrintManagement Core,Desk {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration…}
Binary 1.0.11 ProcessMitigations Core,Desk {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy}
Script 3.0 Provisioning Core,Desk {Install-ProvisioningPackage, Export-ProvisioningPackage, Install-TrustedProvisioningCertificate, Export-Tr…
Manifest 1.0.0.0 ScheduledTasks Core,Desk {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-ScheduledTask…}
Manifest 2.0.0.0 SecureBoot Core,Desk {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBootUEFI…}
Manifest 2.0.0.0 SmbShare Core,Desk {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess…}
Manifest 2.0.0.0 SmbWitness Core,Desk {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw…}
Manifest 1.0.0.0 StartLayout Core,Desk {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-StartApps}
Manifest 2.0.0.0 Storage Core,Desk {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain…}
Manifest 2.0.0.0 TLS Core,Desk {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-TlsSessionTicketK…
Manifest 1.0.0.0 TroubleshootingPack Core,Desk {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
Manifest 2.0.0.0 TrustedPlatformModule Core,Desk {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm…}
Binary 2.1.639.0 UEV Core,Desk
Manifest 2.0.0.0 VpnClient Core,Desk {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection…}
Manifest 1.0.0.0 Wdac Core,Desk {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn…}
Manifest 2.0.0.0 Whea Core,Desk {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy}
Manifest 1.0.0.0 WindowsDeveloperLicense Core,Desk {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-WindowsDeveloperLicenseRegistration}
Script 1.0 WindowsErrorReporting Core,Desk {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorReporting}
Manifest 1.0.0.0 WindowsSearch Core,Desk {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
Manifest 1.0.0.0 WindowsUpdate Core,Desk Get-WindowsUpdateLog
Manifest 1.0.0.2 WindowsUpdateProvider Core,Desk {Get-WUAVersion, Get-WULastInstallationDate, Get-WULastScanSuccessDate, Get-WUIsPendingReboot…}
Directory: C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Binary 2.6.111.0 AzureInformationProtection Desk
Directory: C:\Users\ohads\.vscode\extensions\ms-vscode.powershell-2020.6.0\modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Script 1.1.3 Plaster Desk {Invoke-Plaster, New-PlasterManifest, Get-PlasterTemplate, Test-PlasterManifest}
Binary 2.1.0 PowerShellEditorServices Core,Desk Start-EditorServices
Binary 0.2.0 PowerShellEditorServices.VSCode Desk {New-VSCodeHtmlContentView, Show-VSCodeHtmlContentView, Close-VSCodeHtmlContentView, Set-VSCodeHtmlContentV…
Script 2.0.2 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…}
Script 1.19.0 PSScriptAnalyzer Desk {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-Formatter}Debug output
DEBUG: 15:25:22 - ConnectAzureRmAccountCommand begin processing with ParameterSet 'ManagedServiceLogin'.
DEBUG: 15:25:22 - using account id '[email protected]'...
DEBUG: 15:25:22 - Autosave setting from startup session: 'CurrentUser'
DEBUG: 15:25:22 - No autosave setting detected in environment variable 'AzContextAutoSave'.
DEBUG: 15:25:22 - Using Autosave scope 'CurrentUser'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'Common', 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/', ValidateAuthority: 'True'
DEBUG: [HttpClientOperations]: Adding Header 'Metadata'
DEBUG: Checking Cache request http://169.254.169.254/metadata/identity/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
http://169.254.169.254/metadata/identity/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01
Headers:
Metadata : true
Body:
DEBUG: Checking Cache request http://localhost:50342/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
http://localhost:50342/oauth2/token?resource=https%3A%2F%2Fmanagement.core.windows.net%2F&api-version=2018-02-01
Headers:
Metadata : true
Body:
Connect-AzAccount: No connection could be made because the target machine actively refused it.
DEBUG: AzureQoSEvent: CommandName - Connect-AzAccount; IsSuccess - False; Duration - 00:00:25.1798902;; Exception - System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it.
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientWithRetry.SendAsync(HttpRequestMessage request, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientOperationsFactory.HttpClientOperations`1.SafeSendRequestAsync(HttpRequestMessage request, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientOperationsFactory.HttpClientOperations`1.GetAsync(String requestUri, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.ManagedServiceAccessTokenBase`1.GetOrRenewAuthentication()
at Microsoft.Azure.Commands.Common.Authentication.ManagedServiceAccessTokenBase`1.get_AccessToken()
at Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2019_06_01.SubscriptionClientWrapper.ListAccountTenants(IAccessToken accessToken, IAzureEnvironment environment)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.<>c__DisplayClass4_0.<ListAccountTenants>b__0(ISubscriptionClientWrapper client)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.<>c.<.ctor>b__2_0(Action`1 subscriptionClientAction, LoggerWriter warning)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.ListAccountTenants(IAccessToken accessToken, IAzureEnvironment environment)
at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.ListAccountTenants(IAzureAccount account, IAzureEnvironment environment, 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, Int32 maxContextPopulation)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass98_0.<ExecuteCmdlet>b__0(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass100_0.<SetContextWithOverwritePrompt>b__0(AzureRmProfile prof, RMProfileClient client)
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.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor)
at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 15:25:48 - ConnectAzureRmAccountCommand end processing.
Error output
HistoryId: 2
Message : No connection could be made because the target machine actively refused it.
StackTrace : at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken
cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2,
CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean
doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken
cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request,
CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientWithRetry.SendAsync(HttpRequestMessage
request, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientOperationsFactory.HttpClientOperations`
1.SafeSendRequestAsync(HttpRequestMessage request, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.HttpClientOperationsFactory.HttpClientOperations`
1.GetAsync(String requestUri, CancellationToken token)
at Microsoft.Azure.Commands.Common.Authentication.ManagedServiceAccessTokenBase`1.GetOrRenewAuthent
ication()
at Microsoft.Azure.Commands.Common.Authentication.ManagedServiceAccessTokenBase`1.get_AccessToken()
at Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Version2019_06_01.SubscriptionClientWr
apper.ListAccountTenants(IAccessToken accessToken, IAzureEnvironment environment)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.<>c__DisplayClass4_0.<ListAccoun
tTenants>b__0(ISubscriptionClientWrapper client)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.<>c.<.ctor>b__2_0(Action`1
subscriptionClientAction, LoggerWriter warning)
at Microsoft.Azure.Commands.Profile.Models.SubscriptionClientProxy.ListAccountTenants(IAccessToken
accessToken, IAzureEnvironment environment)
at
Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.ListAccountTenants(IAzureAccount
account, IAzureEnvironment environment, 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, Int32 maxContextPopulation)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass98_0.<ExecuteCmdl
et>b__0(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass100_0.<SetContext
WithOverwritePrompt>b__0(AzureRmProfile prof, RMProfileClient client)
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.CmdletExtensions.<>c__3`1.<ExecuteSynchronously
OrAsJob>b__3_0(T c)
at
Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
cmdlet, Action`1 executor)
at
Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T
cmdlet)
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Connect-AzAccount}
Line : Connect-AzAccount -Identity:$false
Position : At line:1 char:1
+ Connect-AzAccount -Identity:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 2
Message : No connection could be made because the target machine actively refused it.
StackTrace : at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken
cancellationToken)
Exception : System.Net.Sockets.SocketException
InvocationInfo : {Connect-AzAccount}
Line : Connect-AzAccount -Identity:$false
Position : At line:1 char:1
+ Connect-AzAccount -Identity:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 2
Metadata
Metadata
Assignees
Labels
AccountsIssues in Az.Accounts except authentication relatedIssues in Az.Accounts except authentication relatedfeature-requestThis issue requires a new behavior in the product in order be resolved.This issue requires a new behavior in the product in order be resolved.needs-team-attentionThis issue needs attention from Azure service team or SDK teamThis issue needs attention from Azure service team or SDK team
Activity
[-]"Connect-AzAccount -Identity:$false" behaves differently than `"onnect-AzAccount"[/-][+]"Connect-AzAccount -Identity:$false" trie to connect to managed identity (bare "Connect-AzAccount" does not)[/+]dingmeng-xue commentedon Sep 8, 2020
Ohad Schneider (@ohadschn) ,
-Identityis a switch parameter instead of boolean parameter. You should not add $false and actually cmdlet implementation only checks it is present or not.https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7#switch-parameters
ohadschn commentedon Sep 8, 2020
I realize that is the current implementation, but it does not follow PowerShell conventions. For example, this will work as expected:
New-Item -Type Directory "SomeExistingFolder" -Force:$false(in this case, fail since the folder exists).Specifically, it makes parametrizing switch arguments more annoying (my actual use case is something like
Connect-AzAccount -Identity:$RunningOnVm). Indeed, the fact thatFoo-Option -SomeSwitchParam:$SomeBoolVariableis legal PowerShell is proof that such usage should be supported.Your code should look like this, which handles both cases correctly:
alexandair commentedon Sep 10, 2020
Dingmeng Xue (@dingmeng-xue)
Ohad Schneider (@ohadschn) is correct. Switch parameters don't need to use -SwitchParam:$false or -SwitchParam:$true like the Boolean parameters, but they surely support that syntax.
-SwitchParam:$false needs to behave the same as when you don't specify -SwitchParam at all.
[-]"Connect-AzAccount -Identity:$false" trie to connect to managed identity (bare "Connect-AzAccount" does not)[/-][+]"Connect-AzAccount -Identity:$false" tries to connect to managed identity (bare "Connect-AzAccount" does not)[/+]dingmeng-xue commentedon Jan 20, 2022
Aleksandar Nikolić (@alexandair) , Ohad Schneider (@ohadschn) , when
-Identityswitch presents, the logic is going to parameter set of managed service login. If-Identity:$falsewhat's the next step? default behavior?alexandair commentedon Jan 20, 2022
Dingmeng Xue (@dingmeng-xue)
Connect-AzAccount ... -Identity:$falseshould behave exactly the same asConnect-AzAccount ....-SwitchParameter:$falseshould produce the same result as when you don't specify that parameter at all.dingmeng-xue commentedon Jan 24, 2022
Parameter sets introduced by PowerShell enable user to write a single function that can do different actions for different scenarios
-Identityis specifically used for log in with managed identity. Azure PowerShell introduces this switch parameter to emphasize that purpose. Although technically respecting $false is achievable, it will confuse implementation when parameters working with-Identityare invalid in default parameter set. It makes burden on maintenance for long term.ManagedIdentity is special login approach. User should determine it when scripting, could you explain further what user scenario requires the feature of disabling MSI in runtime?
ohadschn commentedon Jan 24, 2022
For us the use case is pretty common - we have multiple scripts we want to be able to run both locally and during deployment on some VM / container. So ideally each such script could do something like
Connect-AzAccount ... -Identity:$isLocalRun(instead we have to separate the cases usingif/elseand duplicate all the parameters we pass).As Aleksandar Nikolić (@alexandair) mentioned, specifying
$falsereally should behave exactly the same as when the switch wasn't specified at all. IMHO breaking such a fundamental contract in an official Microsoft library is not reasonable, even if it incurs some implementation burden. But perhaps if you pointed us to the code we would be able to assist in minimizing this burden...ohadschn commentedon Jan 24, 2022
OK so I'm guessing the code in question is here:
azure-powershell/src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs
Line 331 in b1b9308
I couldn't find anything official, but a few places (example 1, example 2) mentioned that switching on
ParameterSetNameis somewhat of an anti-pattern. Checking the values of the actual parameters instead (e.g.if (Identity)...) would prevent this issue and ultimately be more directly logical.dingmeng-xue commentedon Jan 24, 2022
Here is one common example. One cmdlet Test-AzResource has 2 parameter sets.
One, default parameter set, just has mandatory parameter
-nameAnother one has switch parameter with couple additional parameters
If design is already as it is, how to handle
-Identity:$false?alexandair commentedon Jan 25, 2022
Dingmeng Xue (@dingmeng-xue) is right.
Ohad Schneider (@ohadschn) You'll have to use a conditional statement and 2 commands.
Setting a switch parameter value to $false doesn't undo the parameter set determination.
ohadschn commentedon Jan 27, 2022
Indeed, which is why I said:
So if we take the currently discussed
Connect-AzAccountas an example, instead ofYou would do
The point is, parameter set resolution is nice for user parameter validation, but it should not determine your logic.
dingmeng-xue commentedon Jan 27, 2022
Hi Ohadshn, I agree that current
Connect-AzAccountcan change the logic as you described. But it will introduce problem in future. For instance, Default parameter set ofConnect-AzAccountis below for the time being (I remove some parameters and simplify example)the syntax of ManagedServiceParameterSet is
Since both parameter sets share the same parameters, we can fallback
-Identity:$falseto default parameter.However when we introduce the new feature and add required parameter
-Dummyon default parameter set, the fallback logic cannot work anymore. It will show error message that-Dummycannot be found however ManagedServiceParameterSet doesn't support-Dummy. It will confuse user. You probably complain it again due to your script is broken.ohadschn commentedon Jan 27, 2022
Sorry not sure I follow, you're saying you'll add a new parameter set that looks like this:
Connect-AzAccount [-Environment <String>] [-Tenant <String>] [-AccountId <String>] -DummyAnd then a call like this will fail parameter set resolution?
Connect-AzAccount ... -Dummy:$false -Identity:$truedingmeng-xue commentedon Jan 28, 2022
You are right. If
-Dummyparameter doesn't belong to ManagedServiceParameterSet,Connect-AzAccount ... -Dummy:$false -Identity:$truewill return error immediately because PowerShell cannot determine parameter set.dingmeng-xue commentedon Sep 22, 2022
Close this discussion now. Feel free to contact us if there is further question.