Skip to content

refactor!: update namespace from DirectClient to Sdk (#88)#32

Closed
daviburg wants to merge 1 commit intomainfrom
feature/client-options-inherit
Closed

refactor!: update namespace from DirectClient to Sdk (#88)#32
daviburg wants to merge 1 commit intomainfrom
feature/client-options-inherit

Conversation

@daviburg
Copy link
Copy Markdown
Member

@daviburg daviburg commented May 2, 2026

Summary

Update all using directives from Microsoft.Azure.Connectors.DirectClient.{Connector} to Microsoft.Azure.Connectors.Sdk.{Connector} to match the SDK namespace rename.

CI note

CI will fail until the SDK package with the new namespaces is published. This PR serves as reviewer context in the meantime.

Related PRs

Update all using directives from Microsoft.Azure.Connectors.DirectClient.{Connector}
to Microsoft.Azure.Connectors.Sdk.{Connector} to match the SDK namespace
rename in Azure/Connectors-NET-SDK#90.

Depends on: Azure/Connectors-NET-SDK >= 0.9.0
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the DirectConnector sample project to align with the Azure Connectors .NET SDK namespace rename by switching references from Microsoft.Azure.Connectors.DirectClient.* to Microsoft.Azure.Connectors.Sdk.*.

Changes:

  • Updated connector-specific using directives across sample function files to Microsoft.Azure.Connectors.Sdk.{Connector}.
  • Updated a doc <see cref="..."> reference in ConnectorTriggerMetadataAttribute to the new namespace.
  • Updated one fully-qualified Teams request type reference to the new namespace.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
DirectConnector/SmtpFunctions.cs Update SMTP connector namespace import to Microsoft.Azure.Connectors.Sdk.Smtp.
DirectConnector/Program.cs Update DI-time connector client imports to Microsoft.Azure.Connectors.Sdk.*.
DirectConnector/OneDriveFunctions.cs Update OneDrive connector import and BlobMetadata alias namespace.
DirectConnector/Office365UsersFunctions.cs Update Office365 Users connector namespace import.
DirectConnector/MsGraphFunctions.cs Update MS Graph Groups & Users connector namespace import.
DirectConnector/MqFunctions.cs Update IBM MQ connector namespace import.
DirectConnector/ConnectorTriggerMetadataAttribute.cs Update XML doc example reference to Microsoft.Azure.Connectors.Sdk.*.
DirectConnector/ConnectorFunctions.cs Update Office365/SharePoint/Teams imports, BlobMetadata alias, and one Teams type reference.
DirectConnector/AzureLogAnalyticsFunctions.cs Update Log Analytics connector namespace import.
DirectConnector/AzureBlobFunctions.cs Update Azure Blob connector namespace import.

Comment on lines +6 to 7
using Microsoft.Azure.Connectors.Sdk.Azureblob;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +6 to 7
using Microsoft.Azure.Connectors.Sdk.Azureloganalytics;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +7 to 8
using Microsoft.Azure.Connectors.Sdk.Mq;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +6 to 7
using Microsoft.Azure.Connectors.Sdk.Msgraphgroupsanduser;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +6 to 7
using Microsoft.Azure.Connectors.Sdk.Office365users;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +8 to 9
using Microsoft.Azure.Connectors.Sdk.Onedriveforbusiness;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +7 to 8
using Microsoft.Azure.Connectors.Sdk.Smtp;
using Microsoft.Azure.Connectors.Sdk;
Comment on lines +8 to 11
using Microsoft.Azure.Connectors.Sdk.Office365;
using Microsoft.Azure.Connectors.Sdk.Sharepointonline;
using Microsoft.Azure.Connectors.Sdk.Teams;
using Microsoft.Azure.Connectors.Sdk;
daviburg added a commit to Azure/Connectors-NET-SDK that referenced this pull request May 5, 2026
## Summary

Generated connector clients now inherit from `ConnectorClientBase`
instead of implementing `IDisposable` directly. This eliminates ~1,500
lines of duplicated boilerplate across 11 connector files.

## Breaking changes

- **Constructor signature**: new optional `ConnectorClientOptions`
parameter (position 3), `HttpClient` moves to position 4
- **Exception types**: per-connector exceptions (e.g.,
`Office365ConnectorException`) replaced by unified `ConnectorException`
- **Namespace**: `Microsoft.Azure.Connectors.DirectClient.{Connector}` →
`Microsoft.Azure.Connectors.Sdk.{Connector}`
- **Navigator class**: `DirectClientConnectors` → `SdkConnectors`

## SDK core changes

| New type | Purpose |
|----------|---------|
| `ConnectorClientBase` | Convenience constructors,
`CallConnectorAsync`, `ResolveUrl` (SSRF), shared JSON options |
| `TokenCredentialTokenProvider` | Adapts `Azure.Core.TokenCredential`
to `ITokenProvider` |
| `ConnectorException` | Unified exception with `ConnectorName`,
`Operation`, `StatusCode`, `ResponseBody` |

## Generated files

All 11 connector files regenerated via updated `CodefulSdkGenerator`
(not hand-edited). Each client now inherits `ConnectorClientBase`,
overrides `ConnectorName`, and accepts optional
`ConnectorClientOptions`.

## Related PRs

- [BPM generator PR
#15600409](https://msazure.visualstudio.com/One/_git/AzureUX-BPM/pullrequest/15600409)
— generator template changes
-
[Azure/Connectors-NET-LSP#67](Azure/Connectors-NET-LSP#67)
— namespace update
-
[Azure/Connectors-NET-Samples#32](Azure/Connectors-NET-Samples#32)
— namespace update

## Test results

218/218 tests pass ✅

Closes #88
daviburg added a commit that referenced this pull request May 8, 2026
- ARM sample functions (list subscriptions, resource groups, deployments)
  ported from PR #33 with namespace updates for v0.9.0
- README table updated: removed Azure Log Analytics, added Azure Monitor
  Logs and ARM connectors
- Supersedes PRs #32-#38 (incremental unpublished SDK changes)
@daviburg
Copy link
Copy Markdown
Member Author

daviburg commented May 8, 2026

Closing — superseded by #40 which consolidates all SDK v0.9.0-preview.1 breaking changes, namespace migrations, and new features into a single PR.

@daviburg daviburg closed this May 8, 2026
daviburg added a commit that referenced this pull request May 9, 2026
* Upgrade to Azure.Connectors.Sdk 0.9.0-preview.1

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

* Add ArmFunctions.cs + update README for v0.9.0 connector lineup

- ARM sample functions (list subscriptions, resource groups, deployments)
  ported from PR #33 with namespace updates for v0.9.0
- README table updated: removed Azure Log Analytics, added Azure Monitor
  Logs and ARM connectors
- Supersedes PRs #32-#38 (incremental unpublished SDK changes)

* Add local ExceptionExtensions.IsFatal() helper + restore guards

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).

* Address PR feedback: fix naming, credential scope, stale references

- 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>

* Fix using sort order, response naming, unused field

- 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>

* Add missing Configuration using + extract magic string constant

Co-authored-by: Dobby <dobby@microsoft.com>

* Fix README ARM description + ARM response envelopes

Co-authored-by: Dobby <dobby@microsoft.com>

* Prefix ARM function names + fix PR description accuracy

Co-authored-by: Dobby <dobby@microsoft.com>

---------

Co-authored-by: Dobby <dobby@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants