Upgrade to Azure.Connectors.Sdk 0.9.0-preview.1#40
Merged
Conversation
Breaking changes addressed:
- Package: Microsoft.Azure.Connectors.Sdk -> Azure.Connectors.Sdk
- Namespaces: Microsoft.Azure.Connectors.DirectClient.* -> Azure.Connectors.Sdk.*
- Models sub-namespace: types now in Azure.Connectors.Sdk.{Connector}.Models
- PascalCase client names: SharePointOnlineClient, OneDriveForBusinessClient,
MsGraphGroupsAndUsersClient, AzureBlobClient
- Constructors: removed managedIdentityClientId parameter, use TokenCredential
- Exceptions: per-connector types replaced with unified ConnectorException
(inherits RequestFailedException, .Status instead of .StatusCode)
- IsFatal(): removed (now internal), use plain catch (Exception ex)
- AzureLogAnalytics: replaced with AzureMonitorLogs connector
New capabilities demonstrated:
- DI extension methods (AddOffice365Client, etc.) replace 15+ lines of
boilerplate per connector with one-liner config-driven registration
- DefaultAzureCredential via DI for local dev authentication
- ARM connector added
- local.settings.json.template updated with AzureMonitorLogs + ARM entries
daviburg
commented
May 8, 2026
This was referenced May 8, 2026
There was a problem hiding this comment.
Pull request overview
This pull request upgrades the DirectConnector sample to Azure.Connectors.Sdk 0.9.0-preview.1, updating namespaces/client names, switching to the new DI registration extensions, and aligning error handling with the unified ConnectorException.
Changes:
- Bump the SDK package reference to
Azure.Connectors.Sdk0.9.0-preview.1and update namespaces/models across all connector samples. - Simplify
Program.csby registering connector clients viaservices.Add*Client(...)extension methods and registering a sharedTokenCredential. - Replace connector-specific exceptions with
ConnectorExceptionand migrate fromStatusCodetoStatusin error handling.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| DirectConnector/SmtpFunctions.cs | Switch SMTP client/models to Azure.Connectors.Sdk and update exception handling. |
| DirectConnector/Program.cs | Replace manual client factories with SDK DI extension methods and shared TokenCredential. |
| DirectConnector/OneDriveFunctions.cs | Update OneDrive client/models and exception handling to the new SDK. |
| DirectConnector/Office365UsersFunctions.cs | Update Office365 Users client/models and exception handling to the new SDK. |
| DirectConnector/MsGraphFunctions.cs | Update MS Graph client/models and exception handling to the new SDK. |
| DirectConnector/MqFunctions.cs | Update MQ client/models and exception handling to the new SDK. |
| DirectConnector/local.settings.json.template | Replace Azure Log Analytics config keys with Azure Monitor Logs and add ARM config keys. |
| DirectConnector/DirectConnector.csproj | Swap package reference to Azure.Connectors.Sdk 0.9.0-preview.1. |
| DirectConnector/ConnectorTriggerMetadataAttribute.cs | Update documentation references to the new SDK namespaces. |
| DirectConnector/ConnectorFunctions.cs | Update Office365/SharePoint/Teams clients/models and exception handling to the new SDK. |
| DirectConnector/AzureLogAnalyticsFunctions.cs | Migrate to Azure Monitor Logs client/models and update operations/exception handling. |
| DirectConnector/AzureBlobFunctions.cs | Update Azure Blob client/models and exception handling to the new SDK. |
Comments suppressed due to low confidence (1)
DirectConnector/ConnectorFunctions.cs:175
- Catching all exceptions and converting them into an HTTP 500 response can inadvertently swallow fatal process-level exceptions (OOM, StackOverflow, etc.). Consider reintroducing a fatal-exception filter (e.g.,
catch (Exception ex) when (!IsFatal(ex))) or rethrowing known-fatal exceptions so the host can terminate appropriately.
catch (Exception ex)
{
this._logger.LogError(ex, "Error in SendEmail.");
var errorResponse = request.CreateResponse(HttpStatusCode.InternalServerError);
The SDK made IsFatal() internal in v0.9.0. Add a local copy so sample exception handling follows the recommended pattern of not catching fatal exceptions (OOM, StackOverflow, AccessViolation, SEH, ThreadAbort).
- Fix _SmtpClient/_AzureBlobClient to _smtpClient/_azureBlobClient (camelCase) - Register DefaultAzureCredential only in Development environment - Replace all 'DirectClient SDK' doc references with 'Azure Connectors SDK' - Add remarks to AzureLogAnalyticsFunctions noting Monitor Logs rename Co-authored-by: Dobby <dobby@microsoft.com>
- Sort using directives: System.* first, then alphabetically (9 files) - AzureLogAnalyticsFunctions: return workspaces= in response body for backward compatibility with route naming - ArmFunctions: remove unused JsonOptions field and System.Text.Json using Co-authored-by: Dobby <dobby@microsoft.com>
Co-authored-by: Dobby <dobby@microsoft.com>
Co-authored-by: Dobby <dobby@microsoft.com>
Co-authored-by: Dobby <dobby@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades from
Microsoft.Azure.Connectors.Sdk0.8.0-preview.1 toAzure.Connectors.Sdk0.9.0-preview.1 (release notes).Breaking Changes Addressed
Microsoft.Azure.Connectors.SdkAzure.Connectors.SdkMicrosoft.Azure.Connectors.DirectClient.*Azure.Connectors.Sdk.*+.ModelsSharepointonlineClientSharePointOnlineClient(PascalCase)new XxxClient(url, managedIdentityClientId)new XxxClient(url, credential)Office365ConnectorException.StatusCodeConnectorException.StatusIsFatal()ExceptionExtensions.IsFatal()ExceptionExtensions.cshelper restores the guardNew Capabilities Demonstrated
Program.csreduced from ~150 lines to ~30 lines usingAddOffice365Client(),AddTeamsClient(), etc.DefaultAzureCredentialvia DI — single registration used by all connector clients for local dev (Development environment only)ArmFunctions.cs(4 endpoints)ConnectorException— inheritsRequestFailedException, all connectors use the same exception typeValidation
Azure.Connectors.Sdk 0.9.0-preview.1