Open
Description
openedon Nov 9, 2018
When a user has Contributor role assigned and deletes a VMSS VM instance it throws an error due to a resource group delete lock via the SDK yet when deleting an instance with same user via the Azure Portal it works without any exception.
- .Net 4.8.2
- 1.17 Version Fluent
- Microsoft.Rest.ClientRuntime v.2.3.17
- Microsoft.Rest.ClientRuntime.Azure v3.3.18
- Microsoft.Rest.ClientRuntime.Azure.Authentication v.3.3.18
System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> Microsoft.Rest.Azure.CloudException: The scope '/subscriptions//resourceGroups//providers/Microsoft.Compute/virtualMachineScaleSets//virtualmachines/22' cannot perform delete operation because following scope(s) are locked: '/subscriptions//resourceGroups/***'. Please remove the lock and try again.
var vmSet = await Repo.VirtualMachineScaleSets.GetByIdAsync(setId);
var instances = await vmSet.VirtualMachines.ListAsync();
foreach (var instanceName in instanceNames)
{
await instanceName.DeleteAsync());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment