azure-sdk-for-net
azure-sdk-for-net copied to clipboard
[BUG] Failed to create VirtualMachineScalesetextensionResource with exception Value cannot be null. (Parameter 'id')
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
Thank you for your feedback. Tagging and routing to the team member best able to assist.
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);
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: |
|
Milestone: | - |
Hi @fengzhou-msft ,
Here is what I got in the log. Let me know if you need more information.
@GabstaMSFT can you please take a look at this issue? Thanks!
@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.
@v-bafa, I am taking a look into this.
@grizzlytheodore to take a look at this.
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
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
VMSS is team is working on adding ID to the operation response
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.
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.