Not obvious behavior of XXXWithHttpMessagesAsyn functions. In cases of BadRequest or NotFound, I expect to get a response with an HTTP status code, but not an exception
_cdnManagementClient.AFDEndpoints.GetWithHttpMessagesAsync("not_existing_resourcegroup", "profilename", "endpointname")