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

Update-AzAksNodePool -NodeImageOnly gives error: Non-static method requires a target #24337

Closed
mpowrie opened this issue Mar 12, 2024 · 1 comment · Fixed by #24506
Closed
Assignees
Labels
AKS Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Investigate 🔍

Comments

@mpowrie
Copy link

mpowrie commented Mar 12, 2024

Description

When trying to update the image version of an empty Windows node pool, I get the following error message:
Non-static method requires a target.
Commands tried:

$clusters = Get-AzAksCluster
$cluster = $clusters[0]
$windowsnodepools = Get-AzAksNodePool -ClusterObject $cluster | Where-Object OsType -EQ "Windows"
$windowsnodepool = $windowsNodePools[0]
Update-AzAksNodePool -NodeImageOnly -Id $windowsNodePool.Id
Update-AzAksNodePool -NodeImageOnly -InputObject $windowsNodePool

Issue script & Debug output

PS> $DebugPreference='Continue'
PS> Update-AzAksNodePool -NodeImageOnly -InputObject $windowsNodePool
DEBUG: 11:21:32 AM - UpdateAzureRmAksNodePool begin processing with ParameterSet 'InputObjectParameterSet'.
DEBUG: 11:21:32 AM - using account id '[email protected]'...
DEBUG: 11:21:32 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: 'xxx'
DEBUG: 11:21:32 AM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 11:21:32 AM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'xxx', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'[email protected]'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: 
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z] Found 1 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z] Returning 1 accounts
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] MSAL MSAL.CoreCLR with assembly version '4.56.0.0'. CorrelationId(xxx)
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] === AcquireTokenSilent Parameters ===   
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] LoginHint provided: False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] Account provided: True
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] ForceRefresh: False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] 
=== 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 - xxx
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured: 

DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] === Token Acquisition (SilentRequest) started:
         Scopes: https://management.core.windows.net//.default
        Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] Access token is not expired. Returning the found cache entry. [Current time (03/12/2024 00:21:32) - Expiration Time (03/12/2024 01:20:20 +00:00) - Extended Expiration Time (03/12/2024 01:20:20 +00:00)]
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] [Region discovery] Not using a regional authority. 
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx] 
        === Token Acquisition finished successfully:
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.22631 [2024-03-12 00:21:32Z - xxx]  AT expiration time: 12/03/2024 1:20:20 AM +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:  ExpiresOn: 2024-03-12T01:20:20.0000000+00:00        
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: 'xxx', UserId: '[email protected]'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/xxx/resourceGroups/klusternamexxx/providers/Microsoft.ContainerService/managedClusters/klusternamexxx/agentPools/win?api-version=2023-04-01

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : xxx

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-reads: 11997
x-ms-correlation-request-id   : xxx
x-ms-request-id               : xxx
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-routing-request-id       : AUSTRALIASOUTHEAST:20240312T002135Z:xxx
X-Content-Type-Options        : nosniff
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: xxx Ref B: xxx Ref C: 2024-03-12T00:21:33Z
Date                          : Tue, 12 Mar 2024 00:21:35 GMT

Body:
{
  "id": "/subscriptions/xxx/resourcegroups/klusternamexxx/providers/Microsoft.ContainerService/managedClusters/klusternamexxx/agentPools/win",
  "name": "win",
  "type": "Microsoft.ContainerService/managedClusters/agentPools",
  "properties": {
    "count": 0,
    "vmSize": "Standard_D8s_v3",
    "osDiskSizeGB": 200,
    "osDiskType": "Ephemeral",
    "kubeletDiskType": "OS",
    "vnetSubnetID": "/subscriptions/xxx/resourceGroups/klusternamexxx/providers/Microsoft.Network/virtualNetworks/klusternamexxx-vnet/subnets/default",
    "maxPods": 100,
    "type": "VirtualMachineScaleSets",
    "enableAutoScaling": false,
    "scaleDownMode": "Delete",
    "provisioningState": "Succeeded",
    "powerState": {
      "code": "Running"
    },
    "orchestratorVersion": "1.27.7",
    "currentOrchestratorVersion": "1.27.7",
    "enableNodePublicIP": false,
    "tags": {
      "Environment": "Test"
    },
    "mode": "User",
    "enableEncryptionAtHost": false,
    "enableUltraSSD": false,
    "osType": "Windows",
    "osSKU": "Windows2022",
    "nodeImageVersion": "AKSWindows-2022-containerd-20348.2322.240227",
    "upgradeSettings": {},
    "enableFIPS": false
  }
}


DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/xxx/resourceGroups/klusternamexxx/providers/Microsoft.ContainerService/managedClusters/klusternamexxx/agentPools/win/upgradeNodeImageVersion?api-version=2023-04-01

Headers:
Accept-Language               : en-US
x-ms-client-request-id        : xxx

Body:



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

Status Code:
Accepted

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Location                      : https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/locations/australiasoutheast/operationresults/xxx?api-version=2017-08-31&t=xxx
x-ms-ratelimit-remaining-subscription-writes: 1199
Azure-AsyncOperation          : https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/locations/australiasoutheast/operations/xxx?api-version=2017-08-31&t=xxx&c=xxx
x-ms-correlation-request-id   : xxx
x-ms-request-id               : xxx
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-routing-request-id       : AUSTRALIASOUTHEAST:20240312T002138Z:xxx
X-Content-Type-Options        : nosniff
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: xxx Ref B: xxx Ref C: 2024-03-12T00:21:35Z
Date                          : Tue, 12 Mar 2024 00:21:37 GMT

Body:
{
  "id": "/subscriptions/xxx/resourcegroups/klusternamexxx/providers/Microsoft.ContainerService/managedClusters/klusternamexxx/agentPools/win",
  "name": "win",
  "type": "Microsoft.ContainerService/managedClusters/agentPools",
  "properties": {
    "count": 0,
    "vmSize": "Standard_D8s_v3",
    "osDiskSizeGB": 200,
    "osDiskType": "Ephemeral",
    "kubeletDiskType": "OS",
    "vnetSubnetID": "/subscriptions/xxx/resourceGroups/klusternamexxx/providers/Microsoft.Network/virtualNetworks/klusternamexxx-vnet/subnets/default",
    "maxPods": 100,
    "type": "VirtualMachineScaleSets",
    "enableAutoScaling": false,
    "scaleDownMode": "Delete",
    "provisioningState": "UpgradingNodeImageVersion",
    "powerState": {
      "code": "Running"
    },
    "orchestratorVersion": "1.27.7",
    "currentOrchestratorVersion": "1.27.7",
    "enableNodePublicIP": false,
    "tags": {
      "Environment": "Test"
    },
    "mode": "User",
    "enableEncryptionAtHost": false,
    "enableUltraSSD": false,
    "osType": "Windows",
    "osSKU": "Windows2022",
    "nodeImageVersion": "AKSWindows-2022-containerd-20348.2322.240227",
    "upgradeSettings": {},
    "enableFIPS": false
  }
}


DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/locations/australiasoutheast/operations/xxx?api-version=2017-08-31&t=xxx&c=xxx

Headers:
x-ms-client-request-id        : xxx

Body:



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

Status Code:
OK

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
x-ms-ratelimit-remaining-subscription-reads: 11997
x-ms-correlation-request-id   : xxx
x-ms-request-id               : xxx
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-routing-request-id       : AUSTRALIASOUTHEAST:20240312T002208Z:xxx
X-Content-Type-Options        : nosniff
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: xxx Ref B: xxx Ref C: 2024-03-12T00:22:08Z
Date                          : Tue, 12 Mar 2024 00:22:07 GMT

Body:
{
  "name": "xxx",
  "status": "Succeeded",
  "startTime": "2024-03-12T00:21:38.3126072Z",
  "endTime": "2024-03-12T00:21:56.9105433Z",
  "error": {
    "code": "NotLatestOperation",
    "message": "Cannot proceed with the operation. Either the operation has been preempted by another one, or the information needed by the operation failed to be saved (or hasn't been saved yet)."
  }
}


DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/locations/australiasoutheast/operationresults/xxx?api-version=2017-08-31&t=xxx&c=xxx

Headers:
x-ms-client-request-id        : xxx

Body:



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

Status Code:
NoContent

Headers:
Cache-Control                 : no-cache
Pragma                        : no-cache
Location                      : https://management.azure.com/subscriptions/xxx/providers/Microsoft.ContainerService/locations/australiasoutheast/operationresults/xxx?api-version=2017-08-31&xxx
x-ms-ratelimit-remaining-subscription-reads: 11996
x-ms-correlation-request-id   : xxx
x-ms-request-id               : xxx
Strict-Transport-Security     : max-age=31536000; includeSubDomains
x-ms-routing-request-id       : AUSTRALIASOUTHEAST:20240312T002208Z:xxx
X-Content-Type-Options        : nosniff
X-Cache                       : CONFIG_NOCACHE
X-MSEdge-Ref                  : Ref A: xxx Ref B: xxx Ref C: 2024-03-12T00:22:08Z
Date                          : Tue, 12 Mar 2024 00:22:08 GMT

Body:



DEBUG: 11:22:07 AM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 11:22:07 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Update-AzAksNodePool: Non-static method requires a target.
DEBUG: 11:22:07 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 11:22:07 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 11:22:07 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Aks:6.0.1; CommandName: Update-AzAksNodePool; PSVersion: 7.4.1; IsSuccess: False; Duration: 00:00:34.9290306; Exception: Non-static method requires a target.;
DEBUG: 11:22:07 AM - UpdateAzureRmAksNodePool end processing.

Environment data

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
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

PS> Get-Module Az*

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.16.0                Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script     6.0.1                 Az.Aks                              {Disable-AzAksAddOn, Enable-AzAksAddOn, Get-AzAksCluster, Get-AzAksNodePool…}

Error output

PS> resolve-AzError

   HistoryId: 12

Message        : Non-static method requires a target.
StackTrace     :    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
                    at System.Reflection.PropertyInfo.GetValue(Object obj)
                    at Microsoft.Azure.Commands.Aks.Models.AdapterHelper`2.Adapt(Source source)
                    at Microsoft.Azure.Commands.Aks.Commands.UpdateAzureRmAksNodePool.<>c__DisplayClass44_0.<ExecuteCmdlet>b__0()
                    at Microsoft.Azure.Commands.Aks.KubeCmdletBase.RunCmdLet(Action action)
                    at Microsoft.Azure.Commands.Aks.Commands.UpdateAzureRmAksNodePool.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()
Exception      : System.Reflection.TargetException
InvocationInfo : {Update-AzAksNodePool}
Line           : update-AzAksNodePool -NodeImageOnly -InputObject $windowsNodePool
Position       : At line:1 char:1
                 + update-AzAksNodePool -NodeImageOnly -InputObject $windowsNodePool
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 12
@mpowrie mpowrie 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 Mar 12, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Mar 12, 2024
@isra-fel isra-fel added Azure PS Team Investigate 🔍 AKS and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Mar 14, 2024
@isra-fel
Copy link
Member

Looks like an issue in the customized script @Nickcandy can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS Azure PS Team bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Investigate 🔍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants