Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzVmss Accepts Empty Values for -ResourceGroupName and -VMScaleSetName #20095

Closed
mbrat2005 opened this issue Nov 11, 2022 · 6 comments
Closed
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute - VMSS Service Attention This issue is responsible by Azure service team.

Comments

@mbrat2005
Copy link

Description

The 'Get-AzVMSS' command accepts empty strings for the -ResourceGroupName and -VMScaleSetName parameters and proceeds as if those parameters were not provided. This is inconsistent with other Az module commands.

For example, this is how I'd expect the cmdlet to repond to a blank value:
Get-AzVM -ResourceGroupName "rg-vmss" -Name ''
Get-AzVM: Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

Issue script & Debug output

Get-AzVmss -ResourceGroupName '' -VMScaleSetName ''
DEBUG: Sought all Az modules and got latest version 0.0.0
DEBUG: 13:07:00 - GetAzureRmVmss begin processing with ParameterSet 'DefaultParameter'.
DEBUG: 13:07:00 - using account id '***'...
DEBUG: 13:07:00 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning
default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '***', environment: 'AzureCloud',
tenant: '***'
DEBUG: 13:07:00 - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync -
TenantId:'***', Scopes:'https://management.core.windows.net//.default',
AuthorityHost:'https://login.microsoftonline.com/', UserId:'***'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.44 -
cd29741b-ebed-468a-ba67-a716b4346ec2] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.45 -
cd29741b-ebed-468a-ba67-a716b4346ec2] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.46 -
cd29741b-ebed-468a-ba67-a716b4346ec2] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.46] Found 5 cache accounts
and 0 broker accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.46] Returning 5 accounts
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] MSAL MSAL.Desktop with assembly version '4.39.0.0'.
CorrelationId(4cca2eb9-7446-4053-a3aa-33b98c54c370)
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] LoginHint provided: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] Account provided: True
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] ForceRefresh: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - 4cca2eb9-7446-4053-a3aa-33b98c54c370
UserAssertion set: False
LongRunningOboCacheKey set: False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.47 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] === Token Acquisition (SilentRequest) started:
  Scopes: https://management.core.windows.net//.default
 Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.50 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.50 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] Access token is not expired. Returning the found cache entry. [Current time
(11/11/2022 20:07:00) - Expiration Time (11/11/2022 21:00:46 +00:00) - Extended Expiration Time (11/11/2022 21:00:46
+00:00)]
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.50 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.51 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.57 -
4cca2eb9-7446-4053-a3aa-33b98c54c370] Fetched access token from host login.microsoftonline.com.
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.57 -
4cca2eb9-7446-4053-a3aa-33b98c54c370]
 === Token Acquisition finished successfully:
DEBUG: False MSAL 4.39.0.0 MSAL.Desktop 4.8 or later Windows 10 Enterprise [11/11 20:07:00.57 -
4cca2eb9-7446-4053-a3aa-33b98c54c370]  AT expiration time: 11/11/2022 21:00:46 +00:00, scopes
https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default source Cache from
 login.microsoftonline.com appHashCode 22663768
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ]
ParentRequestId:  ExpiresOn: 2022-11-11T21:00:46.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '5cec9263-ff9e-4992-9ad0-c72a70a9aa1f',
UserId: '[email protected]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/***/providers/Microsoft.Compute/virtualMach
ineScaleSets?api-version=2022-03-01

Headers:
x-ms-client-request-id        : c1bfa59b-db09-4709-a8e7-ccc521b256d9
accept-language               : en-US

Body:


DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-reads: 11999
x-ms-request-id               : 0d8d581e-6a2f-40e6-860e-488db189be11
x-ms-correlation-request-id   : 0d8d581e-6a2f-40e6-860e-488db189be11
x-ms-routing-request-id       : CENTRALUS:20221111T200701Z:0d8d581e-6a2f-40e6-860e-488db189be11
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Fri, 11 Nov 2022 20:07:00 GMT

Body:
{
  "value": []
}

DEBUG: 13:07:01 - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Compute:4.30.0; CommandName: Get-AzVmss; PSVersion: 5.1.22621.436; IsSuccess: True;
Duration: 00:00:00.8257261
DEBUG: Finish sending metric.
DEBUG: 13:07:01 - GetAzureRmVmss end processing.

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.22623
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                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.10.2                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     5.0.0                 Az.Compute                          {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script     6.3.1                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}

Error output

No response

@mbrat2005 mbrat2005 added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Nov 11, 2022
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Nov 11, 2022
@dingmeng-xue dingmeng-xue added Compute - VMSS CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. labels Nov 13, 2022
@ghost
Copy link

ghost commented Nov 13, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@SaurabhSharma-MSFT SaurabhSharma-MSFT self-assigned this Nov 14, 2022
@SaurabhSharma-MSFT
Copy link
Member

@mbrat2005 Thanks for your feedback! We will investigate and update as appropriate.

@SaurabhSharma-MSFT
Copy link
Member

@mbrat2005 Is this issue fixed as I see you have submitted PR's ?

@mbrat2005
Copy link
Author

Hi @SaurabhSharma-MSFT, I have not submitted a PR which would address this issue.

@ArmaanMcleod
Copy link
Contributor

ArmaanMcleod commented Dec 31, 2022

Hi @SaurabhSharma-MSFT & @mbrat2005.

I also came across this as well and created a PR with the changes. Hope it can be merged despite it sort of being a breaking change, but honestly I don't see why anyone would want to keep this behaviour since Get-AzVmss -ResourceGroupName '' -VMScaleSetName '' returning nothing is pretty inconsistent in comparison to the parameter validation from Get-AzVm like you pointed out. I got caught off guard in a CICD pipeline where I was passing empty strings to this cmdlet and it just did nothing and didn't error out 😄.

@PramodValavala-MSFT PramodValavala-MSFT added Service Attention This issue is responsible by Azure service team. and removed CXP Attention [Deprecated] The Azure CXP Support Team is responsible for this issue. labels Sep 28, 2023
@microsoft-github-policy-service
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @TravisCragg-MSFT, @sandeepraichura.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. Compute - VMSS Service Attention This issue is responsible by Azure service team.
Projects
None yet
6 participants