Azure / Azure/azure-powershell

ResourceGroupName is honored by Get-AzMaintenanceConfiguration

Open
#15,158 0 comments 0 reactions 0 assignees View on GitHub
bug Maintenance Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

## Description

`Get-AzMaintenanceConfiguration` supports `-ResourceGroupName` but the value of resource group is not used by cmdlet. In below example, the URL of http request doesn't contain resource group name. Since specified resource group is non-existing, it should show 404 error.

## Steps to reproduce

```powershell
PS C:\Dev> Get-AzMaintenanceConfiguration -ResourceGroupName dixue123 -debug

......
=== 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 - 4be10acc-4d3e-48a7-93a9-eb1b385019ea

DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] === Token Acquisition (SilentRequest) started:

Authority Host: login.microsoftonline.com
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] Azure region was not configured or could not be discovered. Not using a regional authority.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] Access token is not expired. Returning the found cache entry. [Current time (06/01/2021 01:22:14) - Expiration Time (06/01/2021 02:21:45 +00:00) - Extended Expiration Time (06/01/2021 02:21:45 +00:00)]
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] Returning access token found in cache. RefreshOn exists ? False
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] Fetched access token from host login.microsoftonline.com.
DEBUG: (False) MSAL 4.30.1.0 MSAL.NetCore Microsoft Windows 10.0.19043 [06/01/2021 01:22:14 - ] === Token Acquisition finished successfully. An access token was returned with Expiration Time: 06/01/2021 02:21:45 +00:00 and Scopes https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2021-06-01T02:21:45.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '72f988bf-86f1-41af-91ab-2d7cd011db47', UserId: 'dixue@microsoft.com'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/{}/providers/Microsoft.Maintenance/maintenanceConfigurations?api-version=2021-05-01

Headers:
x-ms-client-request-id : 9b88efc8-dd03-43c8-bb3a-2d16ca5d9dc3
Accept-Language : en-US

Body:

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

Status Code:
OK

Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-request-id : d5fd9403-6c72-47cb-91ce-1eef48114d5d
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-correlation-request-id : d5fd9403-6c72-47cb-91ce-1eef48114d5d
x-ms-routing-request-id : SOUTHEASTASIA:20210601T012214Z:d5fd9403-6c72-47cb-91ce-1eef48114d5d
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Date : Tue, 01 Jun 2021 01:22:14 GMT

Body:
{
"value": []
}

DEBUG: AzureQoSEvent: CommandName - Get-AzMaintenanceConfiguration; IsSuccess - True; Duration - 00:00:01.0458718
DEBUG: Finish sending metric.
DEBUG: 9:22:15 AM - GetAzureRmMaintenanceConfiguration end processing.
```

## Environment data

```

```

## Module versions

```powershell
PS C:\Dev> Get-Module

ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.3.0 Az.Accounts {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script 3.4.4 Az.KeyVault {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAc…
Script 1.1.1 Az.Maintenance {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenancePublicConfi…
Script 4.1.1 Az.Resources {Add-AzADGroupMember, Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzADAppCredential…}
M
```

## Debug output

```

```

## Error output

```

```

Contributor guide

Open the contributing guide

Research direction

Start at the Get-AzMaintenanceConfiguration cmdlet and reproduce the request with -ResourceGroupName dixue123 using -Debug. Compare the generated URL with the supplied resource-group value; done means the request honors that value and a nonexistent resource group produces the expected 404 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.