Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.87k forks source link

Test-AzPostgreSqlFlexibleServerConnect kill PowerShell host with version 2 of SimplySQL Module #25499

Open HUMBERP opened 4 months ago

HUMBERP commented 4 months ago

Description

If we run the cmdlet

Test-AzPostgreSqlFlexibleServerConnect -ResourceGroupName $serverResourceGroupName -Name $serverName -DatabaseName $databaseName -AdministratorUserName $aadAdministratorName -AdministratorLoginPassword $secureToken -ErrorAction Stop -QueryText $script

The PowerShell host quits when the new version of needed PowerShell Module SimplySQL is installed, with version prior to 2.x the cmdlet works fine.

The issue occurs within file

src/PostgreSql/PostgreSql.Autorest/custom/Test-AzPostgreSqlFlexibleServerConnect.ps1

line 149 and 152 when Open-PostGreConnection is called. The new version of Open-PostGreConnection needs a Credential Parameter instead of Username and Password (OpenPostGreConnection.vb), therefore you get a ParameterBindingException and then the cmdlet uses exit !!!! I highly recommend to rethrow the exception instead of closing the powershell session!

Issue script & Debug output

Can't paste because the powershell host quits ...

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     12.0.0                Az                                  Core,Desk 
Script     3.0.0                 Az.Accounts                         Core,Desk {Disable-AzDataCollection, Disable-AzCon…
Script     2.0.1                 Az.Advisor                          Core,Desk {Disable-AzAdvisorRecommendation, Enable…
Script     6.0.3                 Az.Aks                              Core,Desk {Disable-AzAksAddOn, Enable-AzAksAddOn, …
Script     1.1.5                 Az.AnalysisServices                 Core,Desk {Add-AzAnalysisServicesAccount, Export-A…
Script     4.0.3                 Az.ApiManagement                    Core,Desk {Add-AzApiManagementApiToGateway, Add-Az…
Script     1.0.0                 Az.App                              Core,Desk {Disable-AzContainerAppRevision, Enable-…
Script     1.3.1                 Az.AppConfiguration                 Core,Desk {Clear-AzAppConfigurationDeletedStore, G…
Script     2.2.5                 Az.ApplicationInsights              Core,Desk {Get-AzApplicationInsights, Get-AzApplic…
Script     1.0.1                 Az.ArcResourceBridge                Core,Desk {Get-AzArcResourceBridge, Get-AzArcResou…
Script     2.0.2                 Az.Attestation                      Core,Desk {Add-AzAttestationPolicySigner, Get-AzAt…
Script     1.0.1                 Az.Automanage                       Core,Desk {Get-AzAutomanageBestPractice, Get-AzAut…
Script     1.10.0                Az.Automation                       Core,Desk {Export-AzAutomationDscConfiguration, Ex…
Script     3.6.1                 Az.Batch                            Core,Desk {Disable-AzBatchAutoScale, Disable-AzBat…
Script     2.0.4                 Az.Billing                          Core,Desk {Get-AzBillingAccount, Get-AzBillingInvo…
Script     3.2.0                 Az.Cdn                              Core,Desk {Clear-AzCdnEndpointContent, Clear-AzFro…
Script     2.0.1                 Az.CloudService                     Core,Desk {Get-AzCloudService, Get-AzCloudServiceI…
Script     1.14.1                Az.CognitiveServices                Core,Desk {Get-AzCognitiveServicesAccount, Get-AzC…
Script     8.0.0                 Az.Compute                          Core,Desk {Add-AzImageDataDisk, Add-AzVhd, Add-AzV…
Script     1.0.1                 Az.ConfidentialLedger               Core,Desk {Get-AzConfidentialLedger, New-AzConfide…
Script     4.0.1                 Az.ContainerInstance                Core,Desk {Add-AzContainerInstanceOutput, Get-AzCo…
Script     4.2.1                 Az.ContainerRegistry                Core,Desk {Connect-AzContainerRegistry, Get-AzCont…
Script     1.14.3                Az.CosmosDB                         Core,Desk {Get-AzCosmosDBAccount, Get-AzCosmosDBAc…
Script     1.1.1                 Az.DataBoxEdge                      Core,Desk {Get-AzDataBoxEdgeBandwidthSchedule, Get…
Script     1.7.2                 Az.Databricks                       Core,Desk {Get-AzDatabricksAccessConnector, Get-Az…
Script     1.18.4                Az.DataFactory                      Core,Desk {Add-AzDataFactoryV2DataFlowDebugSession…
Script     1.0.3                 Az.DataLakeAnalytics                Core,Desk {Get-AzDataLakeAnalyticsDataSource, New-…
Script     1.3.1                 Az.DataLakeStore                    Core,Desk {Add-AzDataLakeStoreFirewallRule, Add-Az…
Script     2.4.0                 Az.DataProtection                   Core,Desk {Backup-AzDataProtectionBackupInstanceAd…
Script     1.0.2                 Az.DataShare                        Core,Desk {Get-AzDataShare, Get-AzDataShareAccount…
Script     1.1.0                 Az.DeploymentManager                Core,Desk {Get-AzDeploymentManagerArtifactSource, …
Script     4.3.1                 Az.DesktopVirtualization            Core,Desk {Disconnect-AzWvdUserSession, Expand-AzW…
Script     1.1.1                 Az.DevCenter                        Core,Desk {Deploy-AzDevCenterUserEnvironment, Get-…
Script     1.0.3                 Az.DevTestLabs                      Core,Desk {Get-AzDtlAllowedVMSizesPolicy, Get-AzDt…
Script     1.2.1                 Az.Dns                              Core,Desk {Add-AzDnsRecordConfig, Get-AzDnsRecordS…
Script     1.0.0                 Az.DnsResolver                      Core,Desk {Get-AzDnsForwardingRuleset, Get-AzDnsFo…
Script     1.0.2                 Az.ElasticSan                       Core,Desk {Add-AzElasticSanVolumeGroupNetworkRule,…
Script     2.0.0                 Az.EventGrid                        Core,Desk {Disable-AzEventGridPartnerTopic, Enable…
Script     5.0.0                 Az.EventHub                         Core,Desk {New-AzEventHubAuthorizationRuleSASToken…
Script     1.10.1                Az.FrontDoor                        Core,Desk {Disable-AzFrontDoorCustomDomainHttps, E…
Script     4.0.8                 Az.Functions                        Core,Desk {Get-AzFunctionApp, Get-AzFunctionAppAva…
Script     6.1.0                 Az.HDInsight                        Core,Desk {Add-AzHDInsightClusterIdentity, Add-AzH…
Script     2.0.1                 Az.HealthcareApis                   Core,Desk {Get-AzHealthcareApisService, Get-AzHeal…
Script     0.2.0                 Az.ImageBuilder                     Core,Desk {Get-AzImageBuilderRunOutput, Get-AzImag…
Script     2.7.6                 Az.IotHub                           Core,Desk {Add-AzIotHubCertificate, Add-AzIotHubCo…
Script     6.0.0                 Az.KeyVault                         Core,Desk {Add-AzKeyVaultCertificate, Add-AzKeyVau…
Script     2.3.1                 Az.Kusto                            Core,Desk {Add-AzKustoClusterLanguageExtension, Ad…
Script     1.0.1                 Az.LoadTesting                      Core,Desk {Get-AzLoad, New-AzLoad, Remove-AzLoad, …
Script     1.5.1                 Az.LogicApp                         Core,Desk {Get-AzIntegrationAccount, Get-AzIntegra…
Script     1.1.4                 Az.MachineLearning                  Core,Desk {Add-AzMlWebServiceRegionalProperty, Exp…
Script     1.0.1                 Az.MachineLearningServices          Core,Desk {Get-AzMLServiceQuota, Get-AzMLServiceUs…
Script     1.4.1                 Az.Maintenance                      Core,Desk {Get-AzApplyUpdate, Get-AzConfigurationA…
Script     1.2.1                 Az.ManagedServiceIdentity           Core,Desk {Get-AzFederatedIdentityCredential, Get-…
Script     3.0.1                 Az.ManagedServices                  Core,Desk {Get-AzManagedServicesAssignment, Get-Az…
Script     2.0.1                 Az.MarketplaceOrdering              Core,Desk {Get-AzMarketplaceTerms, Invoke-AzMarket…
Script     1.1.2                 Az.Media                            Core,Desk {Sync-AzMediaServiceStorageKey, Set-AzMe…
Script     2.3.1                 Az.Migrate                          Core,Desk {Get-AzMigrateDiscoveredServer, Get-AzMi…
Script     5.2.1                 Az.Monitor                          Core,Desk {Add-AzLogProfile, Add-AzMetricAlertRule…
Script     1.1.2                 Az.MySql                            Core,Desk {Get-AzMySqlConfiguration, Get-AzMySqlCo…
Script     7.6.0                 Az.Network                          Core,Desk {Add-AzApplicationGatewayAuthenticationC…
Script     1.0.1                 Az.NetworkCloud                     Core,Desk {Deploy-AzNetworkCloudCluster, Disable-A…
Script     1.0.1                 Az.Nginx                            Core,Desk {Get-AzNginxCertificate, Get-AzNginxConf…
Script     1.1.2                 Az.NotificationHubs                 Core,Desk {Get-AzNotificationHub, Get-AzNotificati…
Script     3.2.1                 Az.OperationalInsights              Core,Desk {Disable-AzOperationalInsightsIISLogColl…
Script     1.6.5                 Az.PolicyInsights                   Core,Desk {Get-AzPolicyAttestation, Get-AzPolicyEv…
Script     1.1.1                 Az.PostgreSql                       Core,Desk {Get-AzPostgreSqlConfiguration, Get-AzPo…
Script     2.0.0                 Az.PowerBIEmbedded                  Core,Desk {Resume-AzPowerBIEmbeddedCapacity, Suspe…
Script     1.0.5                 Az.PrivateDns                       Core,Desk {Add-AzPrivateDnsRecordConfig, Get-AzPri…
Script     7.0.0                 Az.RecoveryServices                 Core,Desk {Add-AzRecoveryServicesAsrReplicationPro…
Script     1.9.1                 Az.RedisCache                       Core,Desk {Export-AzRedisCache, Get-AzRedisCache, …
Script     1.2.1                 Az.RedisEnterpriseCache             Core,Desk {Export-AzRedisEnterpriseCache, Get-AzRe…
Script     2.0.1                 Az.Relay                            Core,Desk {Get-AzRelayAuthorizationRule, Get-AzRel…
Script     1.0.0                 Az.ResourceGraph                    Core,Desk {Search-AzGraph, Get-AzResourceGraphQuer…
Script     1.2.1                 Az.ResourceMover                    Core,Desk {Add-AzResourceMoverMoveResource, Get-Az…
Script     7.1.0                 Az.Resources                        Core,Desk {Export-AzResourceGroup, Export-AzTempla…
Script     1.6.2                 Az.Security                         Core,Desk {Add-AzSecurityAdaptiveNetworkHardening,…
Script     3.1.2                 Az.SecurityInsights                 Core,Desk {Get-AzSentinelAlertRule, Get-AzSentinel…
Script     4.0.0                 Az.ServiceBus                       Core,Desk {New-AzServiceBusAuthorizationRuleSASTok…
Script     3.3.3                 Az.ServiceFabric                    Core,Desk {Add-AzServiceFabricClientCertificate, A…
Script     2.0.1                 Az.SignalR                          Core,Desk {Get-AzSignalR, Get-AzSignalRKey, Get-Az…
Script     5.0.0                 Az.Sql                              Core,Desk {Add-AzSqlDatabaseToFailoverGroup, Add-A…
Script     2.2.1                 Az.SqlVirtualMachine                Core,Desk {Get-AzAvailabilityGroupListener, Get-Az…
Script     2.3.2                 Az.StackHCI                         Core,Desk {Add-AzStackHCIVMAttestation, Disable-Az…
Script     1.0.4                 Az.StackHCIVM                       Core,Desk {Add-AzStackHCIVMVirtualMachineDataDisk,…
Script     7.0.0                 Az.Storage                          Core,Desk {Add-AzRmStorageContainerLegalHold, Add-…
Script     1.3.1                 Az.StorageMover                     Core,Desk {Get-AzStorageMover, Get-AzStorageMoverA…
Script     2.1.1                 Az.StorageSync                      Core,Desk {Get-AzStorageSyncCloudEndpoint, Get-AzS…
Script     2.0.1                 Az.StreamAnalytics                  Core,Desk {Get-AzStreamAnalyticsCluster, Get-AzStr…
Script     2.0.0                 Az.Support                          Core,Desk {Get-AzSupportChatTranscript, Get-AzSupp…
Script     3.0.8                 Az.Synapse                          Core,Desk {Add-AzSynapseDataFlowDebugSessionPackag…
Script     1.2.2                 Az.TrafficManager                   Core,Desk {Add-AzTrafficManagerCustomHeaderToEndpo…
Script     3.2.1                 Az.Websites                         Core,Desk {Add-AzWebAppAccessRestrictionRule, Add-…
Binary     2.0.2.182             AzureAD                             Desk      
Binary     2.0.2.149             AzureADPreview                      Desk

Error output

Can't paste because the powershell host quits ...
microsoft-github-policy-service[bot] commented 4 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @daeunyim, @rajsell.

nachoalonsoportillo commented 2 months ago

https://github.com/mithrandyr/SimplySql?tab=readme-ov-file#breaking-changes-for-20