azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Failed to create VirtualMachineScalesetextensionResource with exception Value cannot be null. (Parameter 'id')

Open v-bafa opened this issue 2 years ago • 7 comments

Library name and version

Azure.ResourceManager.Compute 1.0.1

Describe the bug

Try to add extension to the scale set with sdk but failed.

Expected behavior

The extension should be created successfully.

Actual behavior

Got exception above. However, the extension is shown in the extension tab of the scale set.

Reproduction Steps

Execute the following code and got exception.

VirtualMachineScaleSetExtensionData vmssExtensionData = new VirtualMachineScaleSetExtensionData("ExtensionName")
{
xxxx
};
await scaleset.GetVirtualMachineScaleSetExtensions()
                              .CreateOrUpdateAsync(Azure.WaitUntil.Completed, vmssExtensionData.Name, vmssExtensionData);

Exception: Value cannot be null. (Parameter 'id')

at Azure.ResourceManager.ArmResource..ctor(ArmClient client, ResourceIdentifier id) at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionResource..ctor(ArmClient client, ResourceIdentifier id) at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionOperationSource.Azure.Core.IOperationSource<Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionResource>.CreateResult(Response response, CancellationToken cancellationToken) at Azure.Core.NextLinkOperationImplementation.OperationToOperationOfT1.<UpdateStateAsync>d__3.MoveNext() at System.Threading.Tasks.ValueTask1.get_Result() at Azure.Core.OperationInternal1.<UpdateStatusAsync>d__20.MoveNext() at Azure.Core.OperationPoller.<WaitForCompletionAsync>d__11.MoveNext() at Azure.Core.OperationInternalBase.<WaitForCompletionResponseAsync>d__19.MoveNext() at Azure.Core.OperationInternal1.d__19.MoveNext() at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionCollection.CreateOrUpdate(WaitUntil waitUntil, String vmssExtensionName, VirtualMachineScaleSetExtensionData data, CancellationToken cancellationToken)

Environment

.NET SDK: Version: 7.0.102 Commit: 4bbdd14480

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.102\

Host: Version: 7.0.2 Architecture: x64 Commit: d037e070eb

.NET SDKs installed: 6.0.308 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

IDE: Visual Studio 2022

v-bafa avatar Feb 08 '23 07:02 v-bafa

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Feb 08 '23 16:02 jsquire

This looks like an issue caused by service not returning the id property in the CreateOrUpdate operation. @v-bafa can you use below code to enable logging and check the raw response from service and confirm whether it has a null id?

using Azure.Core.Diagnostics;
using System.Diagnostics.Tracing;

// Setup a listener to monitor logged events.
using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger(EventLevel.Verbose);
ArmClientOptions options = new ArmClientOptions()
{
    Diagnostics =
    {
        IsLoggingContentEnabled = true
    }
};
ArmClient client = new ArmClient(cred, subId, options);

fengzhou-msft avatar Feb 09 '23 05:02 fengzhou-msft

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

Issue Details

Library name and version

Azure.ResourceManager.Compute 1.0.1

Describe the bug

Try to add extension to the scale set with sdk but failed.

Expected behavior

The extension should be created successfully.

Actual behavior

Got exception above. However, the extension is shown in the extension tab of the scale set.

Reproduction Steps

Execute the following code and got exception.

VirtualMachineScaleSetExtensionData vmssExtensionData = new VirtualMachineScaleSetExtensionData("ExtensionName")
{
xxxx
};
await scaleset.GetVirtualMachineScaleSetExtensions()
                              .CreateOrUpdateAsync(Azure.WaitUntil.Completed, vmssExtensionData.Name, vmssExtensionData);

Exception: Value cannot be null. (Parameter 'id')

at Azure.ResourceManager.ArmResource..ctor(ArmClient client, ResourceIdentifier id) at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionResource..ctor(ArmClient client, ResourceIdentifier id) at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionOperationSource.Azure.Core.IOperationSource<Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionResource>.CreateResult(Response response, CancellationToken cancellationToken) at Azure.Core.NextLinkOperationImplementation.OperationToOperationOfT1.<UpdateStateAsync>d__3.MoveNext() at System.Threading.Tasks.ValueTask1.get_Result() at Azure.Core.OperationInternal1.<UpdateStatusAsync>d__20.MoveNext() at Azure.Core.OperationPoller.<WaitForCompletionAsync>d__11.MoveNext() at Azure.Core.OperationInternalBase.<WaitForCompletionResponseAsync>d__19.MoveNext() at Azure.Core.OperationInternal1.d__19.MoveNext() at Azure.ResourceManager.Compute.VirtualMachineScaleSetExtensionCollection.CreateOrUpdate(WaitUntil waitUntil, String vmssExtensionName, VirtualMachineScaleSetExtensionData data, CancellationToken cancellationToken) at ASCRemediatorFunction.Remediations.VmssRemediations.InstallLogAnalyticsAgentExtensionOnWindows(ArmClient armClient, OmsWorkSpaceProperties ascWorkSpace, String resourceId, ILogger log) in C:\Data\SourceCode\AzDO\ASCAutomation\ASCRemediatorFunction\Remediations\VmssRemediations.cs:line 49

Environment

.NET SDK: Version: 7.0.102 Commit: 4bbdd14480

Runtime Environment: OS Name: Windows OS Version: 10.0.19044 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.102\

Host: Version: 7.0.2 Architecture: x64 Commit: d037e070eb

.NET SDKs installed: 6.0.308 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

IDE: Visual Studio 2022

Author: v-bafa
Assignees: xboxeer, fengzhou-msft
Labels:

Compute, Service Attention, Mgmt, customer-reported, question, needs-team-attention

Milestone: -

ghost avatar Feb 09 '23 05:02 ghost

Hi @fengzhou-msft ,

Here is what I got in the log. Let me know if you need more information. image

v-bafa avatar Feb 09 '23 22:02 v-bafa

@GabstaMSFT can you please take a look at this issue? Thanks!

hilaryw29 avatar Feb 10 '23 01:02 hilaryw29

@GabstaMSFT there should be the id and type properties parallel to the name property. The Get operation for the VirtualMachineScaleSetExtension resource can return them correctly. image

fengzhou-msft avatar Feb 10 '23 01:02 fengzhou-msft

@v-bafa, I am taking a look into this.

GabstaMSFT avatar Feb 16 '23 19:02 GabstaMSFT

@grizzlytheodore to take a look at this.

Sandido avatar Mar 07 '23 16:03 Sandido

this bug should be addressed from this PR: https://github.com/Azure/azure-sdk-for-net/pull/34644 Which is SDK from swagger update in this PR: https://github.com/Azure/azure-rest-api-specs/pull/22271, in the swagger PR we remove "x-ms-azure-resource: true" tag from SubResourceReadOnly (https://github.com/Azure/azure-rest-api-specs/pull/22271/files#diff-8a700e636a2b2f30c29b236ca3ef91d52850d0eab5a76273e593046e397babb7R158), which is referenced by VirtualMachineScaleSetExtension and that should make ID not mandatory after that.

Has this PR https://github.com/Azure/azure-sdk-for-net/pull/34644 been published? @ArcturusZhang

grizzlytheodore avatar Mar 07 '23 16:03 grizzlytheodore

this bug should be addressed from this PR: #34644 Which is SDK from swagger update in this PR: Azure/azure-rest-api-specs#22271, in the swagger PR we remove "x-ms-azure-resource: true" tag from SubResourceReadOnly (https://github.com/Azure/azure-rest-api-specs/pull/22271/files#diff-8a700e636a2b2f30c29b236ca3ef91d52850d0eab5a76273e593046e397babb7R158), which is referenced by VirtualMachineScaleSetExtension and that should make ID not mandatory after that.

Has this PR #34644 been published? @ArcturusZhang

Yes the swagger PR has been applied to the SDK and the SDK is released but I do not think it will solve this issue. Let us offline discuss about this

ArcturusZhang avatar Mar 08 '23 02:03 ArcturusZhang

VMSS is team is working on adding ID to the operation response

grizzlytheodore avatar Apr 18 '23 21:04 grizzlytheodore

Hi @v-bafa. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar May 09 '23 07:05 github-actions[bot]

Hi @v-bafa, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

github-actions[bot] avatar May 16 '23 10:05 github-actions[bot]