Skip to content

[BUG] Wrong provider when calling PUT verb to Create/Update Chaos Capability #32725

@marcelohazuma

Description

@marcelohazuma

Library name and version

Azure.ResourceManager.Chaos 1.0.0-beta.1

Describe the bug

I'm trying to use the code below to set the Target and Capability for a VMSS, I'm able to create the Target, but I get a 404 when trying to create the Capability:

TokenCredential azureCredential = new DefaultAzureCredential();
ArmClient client = new ArmClient(azureCredential);
SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();
ResourceGroupResource resourceGroup = await subscription.GetResourceGroupAsync("<Resource Group Name>");

VirtualMachineScaleSetResource vmss = await resourceGroup.GetVirtualMachineScaleSetAsync("<Virtual Machine Scale Set Name>");
TargetCollection vmssTargets = resourceGroup.GetTargets(vmss.Id.ResourceType.Namespace, vmss.Id.ResourceType.Type, vmss.Id.Name);

TargetData targetData = new TargetData(new Dictionary<string, BinaryData>());
TargetResource vmssTarget = (await vmssTargets.CreateOrUpdateAsync(Azure.WaitUntil.Completed, "Microsoft-VirtualMachineScaleSet", targetData)).Value;

CapabilityCollection vmssTargetCapabilities = vmssTarget.GetCapabilities();
CapabilityData capabilityData = new CapabilityData();
CapabilityResource vmssCapability = (await vmssTargetCapabilities.CreateOrUpdateAsync(Azure.WaitUntil.Completed, "Shutdown-1.0", capabilityData)).Value;

Expected behavior

I expect to see this URL to set the capability:

PUT https://management.azure.com/subscriptions/abe76e3f-76b7-4c70-9f9c-16686b969eae/resourceGroups/ChaosLab/providers/Microsoft.Compute/virtualMachineScaleSets/CLVMSS/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachineScaleSet/capabilities/Shutdown-2.0?api-version=2022-07-01-preview HTTP/1.1

Actual behavior

But capturing the call with Fiddler, I'm seeing that the first provider is set to Microsoft.Chaos, instead of Microsoft.Compute:

PUT https://management.azure.com/subscriptions/abe76e3f-76b7-4c70-9f9c-16686b969eae/resourceGroups/ChaosLab/providers/Microsoft.Chaos/virtualMachineScaleSets/CLVMSS/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachineScaleSet/capabilities/Shutdown-2.0?api-version=2022-07-01-preview HTTP/1.1

Reproduction Steps

Execute the code in "Describe the bug" using a C# Console application. I'm using .NET Framework 4.7.2.

Environment

No response

Metadata

Metadata

Assignees

Labels

ARMMgmtThis issue is related to a management package.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions