PurviewScanClient.CreateOrUpdateAsync() throws exception instead of returning valid Response when collection is not found.
See original GitHub issueWhen creating a new Purview scan using Postman with a collection referenceName name that does not exist i get a 403 Forbidden containing the following body. The body represents the Schema for Response Error as described on the documentation page.
{
"error": {
"code": "Unauthorized",
"message": "Not authorized to access account"
}
}
When performing the same call from the Azure SDK i get a RequestFailedException()
with Status
403 (same status) but there is no way to access the content of the response because the exception object has no reference to the body
or content
of the response. This masks the actual underlying error which can be beneficial for logging and analysis.
The exceptions message
property also does not contain the full error response message from the Postman example as show below.
Azure.RequestFailedException : Service request failed.
Status: 403 (Forbidden)
Headers:
Date: Wed, 18 May 2022 09:52:31 GMT
Transfer-Encoding: chunked
Strict-Transport-Security: REDACTED
x-ms-correlation-request-id: REDACTED
Stack Trace:
HttpPipelineExtensions.ProcessMessageAsync(HttpPipeline pipeline, HttpMessage message, ClientDiagnostics clientDiagnostics, RequestOptions requestOptions, CancellationToken cancellationToken)
PurviewScanClient.CreateOrUpdateAsync(RequestContent content, RequestOptions options)
ScansClient.CreateOrUpdateScanAsync(PurviewScan scan) line 78
ScansClientTests.Should_Return_Null_On_None_Valid_Collection() line 38
--- End of stack trace from previous location ---
Also, the documentation does not state this exception as an expected response. The documentation does state that a Task<Response>
will be returned.
Another issue is that the error message is misleading in general making the user (like me) search for access control issues instead of a missing collection name. 403 feels like a higher-level error on transport level.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 25bce72f-c954-1e41-765f-c4313caa1028
- Version Independent ID: 7b31d8c8-6300-ebdc-df9a-1cc1ce9b527d
- Content: PurviewScanClient.CreateOrUpdateAsync(RequestContent, RequestOptions) Method (Azure.Analytics.Purview.Scanning) - Azure for .NET Developers
- Content Source: xml/Azure.Analytics.Purview.Scanning/PurviewScanClient.xml
- Service: azure
- GitHub Login: @rloutlaw
- Microsoft Alias: routlaw
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@martijnvanschie Thank you for reaching out, we are looking into it.
@martijnvanschie Thanks for getting back. I am adding Service team to look into this issue and provide an update.