Azure / Azure/azure-powershell

Get-AzSqlElasticPool: elastic pool will fail silently when name of pool is wrong by trailing spaces

Open
#25,680 3 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad bug customer-reported Service Attention SQL - Elastic Jobs
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

affected cmdlet:
Get-AzSqlElasticPool 4.14.0 Az.Sql

**Current Behavior:**

`Get-AzSqlElasticPool` with all arguments being correct except the name of the elastic pool having a trailing space, then the cmdlet will return nothing and will not report an error.

Expected Behavior:

When the name of the elastic pool is wrong due to trailing spaces, then there should be an error (the same behavior if it is wrong by non whitespace)

### Issue script & Debug output

```PowerShell
This will fail silently:
-AzSqlElasticPool -ResourceGroupName "AValidRG" -ServerName "avalidsqlserver" -ElasticPoolName "avalidpool "
Output:
NONE

This will fail normaly:
```Get-AzSqlElasticPool -ResourceGroupName "AValidRG" -ServerName "avalidsqlserver" -ElasticPoolName "wrongpoolalltogether"```
OUTPUT:
```
Get-AzSqlElasticPool: The Resource 'Microsoft.Sql/servers/avalidsqlserver/elasticpools/wrongpoolalltogether' under resource group 'AValidRG' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
```
```

### Environment data

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

### Module versions

```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.17.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 4.14.0 Az.Sql {Add-AzSqlDatabaseToFailoverGroup, Add-AzSqlElasticJobStep, Add-AzSqlElasticJobTarget, Ad…
```

### Error output

```PowerShell
There is no error thats the problem see above!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.