Closed cdifino closed 4 years ago
Hi @cdifino - Followed up with you to get your correlationId, subscriptionId, and resourceGroup info to look at this further. Thanks for getting back to me with it.
You're getting this 204 No Content status code when you're attempting to delete an already deleted roleAssignment - you sent out a request at T = 0 that returned at T = 4 with a 200 response, which is why a request (fired at T = 1) returns a 204.
We should do a better job by making this clearer in our documentation. From the message ExceptionMessage | Operation returned an invalid status code 'NoContent'
, it's not clear to me if that's coming from your code or the .NET SDK. Currently, it looks like it's the latter so I'll respond once I find where this happening and understand why it's the current behavior.
I found the .NET SDK code which leads to this exception. Your best shot is to catch the CloudException, knowing that a 204 represents that that the RoleAssignment you're trying to delete does not exist (in your case, it's already been deleted).
Additional context on DELETE calls to ARM APIs: A 200 (OK) is returned if the object exists and was deleted successfully. A 204 (NoContent) is returned if the resource does not exist and the request is well formed.
Describe the bug When I call : Microsoft.Rest.Azure.CloudException at Microsoft.Azure.Management.Graph.RBAC.Fluent.RoleAssignmentsOperations+d__10.MoveNext
I get a Cloud Exception error with the following message: Operation returned an invalid status code 'NoContent'
Exception or Stack Trace
ExceptionMessage | Operation returned an invalid status code 'NoContent'
ExceptionStackTrace | at Microsoft.Azure.Management.Graph.RBAC.Fluent.RoleAssignmentsOperations.d10.MoveNext() at Microsoft.Azure.Management.Graph.RBAC.Fluent.RoleAssignmentsOperationsExtensions.d 5.MoveNext() at Microsoft.Azure.Management.Graph.RBAC.Fluent.RoleAssignmentsImpl.d12.MoveNext() at Microsoft.Substrate.EuclidCore.Azure.AADRoleAssignmentManager.d 9.MoveNext() at Microsoft.Substrate.AI.Sandbox.SandboxProviders.MSITSandboxManagementService.d9.MoveNext() at Microsoft.Substrate.AI.Sandbox.SandboxProviders.BaseSandboxManagementService`1.d 35.MoveNext() at Microsoft.Substrate.AI.Factory.NotificationsHelper.d5.MoveNext() at Microsoft.Substrate.AI.Factory.NotificationsHelper.<>c.<b 3_3>d.MoveNext() at Microsoft.Substrate.AI.Workspace.WorkspaceMembersService.d11.MoveNext() at System.Threading.Tasks.TaskHelpersExtensions.d 0.MoveNext() at System.Web.Http.Controllers.ApiControllerActionInvoker.d0.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d 5.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d5.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d 0.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d5.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d 5.MoveNext() at System.Web.Http.Filters.ActionFilterAttribute.d0.MoveNext() at System.Web.Http.Controllers.ActionFilterResult.d 2.MoveNext() at System.Web.Http.Filters.AuthorizationFilterAttribute.d2.MoveNext() at System.Web.Http.Filters.AuthorizationFilterAttribute.d 2.MoveNext() at System.Web.Http.Filters.AuthorizationFilterAttribute.d2.MoveNext() at System.Web.Http.Controllers.ExceptionFilterResult.d 0.MoveNext()
ExceptionType | Microsoft.Rest.Azure.CloudException
To Reproduce No steps to reproduce, seems like we are not handling correctly the return status code when calling the following function: this.azureConnection.AccessManagement.RoleAssignments.DeleteByIdAsync(roleAssignment.Id);
Setup (please complete the following information):
Additional context Add any other context about the problem here.
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report