Skip to content

feat(azure.ai.agents): update digital worker contracts - #9789

Merged
Huajie Zhang (jayzhang) merged 24 commits into
mainfrom
huajie/dw_contract_v2
Sep 2, 2026
Merged

feat(azure.ai.agents): update digital worker contracts#9789
Huajie Zhang (jayzhang) merged 24 commits into
mainfrom
huajie/dw_contract_v2

Conversation

@jayzhang

@jayzhang Huajie Zhang (jayzhang) commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates the azure.ai.agents extension to support the latest Digital Worker agent and Microsoft 365 publish contracts.

  • Declares Digital Workers through activity.digitalWorkerType: m365 in azure.yaml, mapped to the service-side digital_worker_type=m365 contract, and reconciles it with the deployed immutable type.
  • Applies the DigitalWorker=V1Preview feature to the agent operations that require the Digital Worker contract.
  • Replaces legacy agentic-user-template publish fields with optionalPermissionScopes and accessBoundaries.
  • Adds azure.yaml schema/runtime validation and azd ai agent publish flags for permission scopes, access boundaries, and explicit boundary clearing.
  • Restricts Digital Worker publication to tenant scope and prevents Digital Worker-only options on simple Activity agents.
  • Uses BotServiceTenant for Digital Worker Activity endpoints while preserving BotServiceRbac for simple Activity agents.
  • Updates documentation and regression coverage for the new behavior.

Why

The previous flow relied on the legacy Microsoft 365 publish payload (publishAsAutopilot and agentic-user-template fields) to identify and configure a Digital Worker. The updated service contract moves Digital Worker classification to the agent resource and exposes permission scopes and access boundaries directly in the publish request.

The extension must treat that classification consistently throughout the lifecycle. In particular, leaving the Activity endpoint on the simple-agent BotServiceRbac scheme after declaring digital_worker_type=m365 causes Agent 365 conversations to enter the Azure RBAC checkaccess path and fail with MISE12042 / AzureAuthorizationModule / BadRequest. A live sample confirmed that changing the endpoint to BotServiceTenant restores conversations.

Contract changes

Agent deploy and discovery

  • Serialize and deserialize digital_worker_type on agent/version models.
  • Map activity.digitalWorkerType: m365 from azure.yaml to the service-side digital_worker_type=m365 contract.
  • Reconcile the local Digital Worker type with the deployed service-side type.
  • Preserve immutable type semantics for update paths and provide delete/recreate guidance when migration is required.
  • Select BotServiceTenant for Digital Workers and BotServiceRbac for simple Activity agents.

Microsoft 365 publish

  • Remove legacy useAgenticUserTemplate and agenticUserTemplate fields.
  • Send optional permission scopes grouped by resource application.
  • Support tri-state access boundaries: omit, set, or explicitly clear.
  • Resolve command-line values over azure.yaml values.

Configuration schema

For a Microsoft 365 Digital Worker, set activity.digitalWorkerType to m365:

activity:
  digitalWorkerType: m365
  publish:
    publishScope: tenant
    optionalPermissionScopes:
      - resourceAppId: <resource-app-id>
        scopes:
          - <scope>
    accessBoundaries:
      - read.1on1.developers

For a simple Activity agent, omit digitalWorkerType:

activity:
  publish:
    publishScope: shared

The schema accepts only m365 when digitalWorkerType is present. An omitted value selects simple mode. The removed activity.useCase field is rejected by both schema and runtime validation so an existing Digital Worker configuration cannot silently fall back to simple mode.

Validation

go test ./...
go fix -diff ./...
azd x build

The endpoint authorization behavior was also validated with a deployed Digital Worker sample: BotServiceRbac reproduced the conversation-time Azure Authorization failure, while BotServiceTenant allowed conversations to proceed.

Fixes #9790

Copilot AI and others added 4 commits August 28, 2026 14:00
Use the service-side m365 classification for deployment and publishing, adopt the updated Microsoft 365 publish body, and expose optional permission scopes and developer access boundaries.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 94d6462f-4a98-46bc-a96e-c6a6e0282d95
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 94d6462f-4a98-46bc-a96e-c6a6e0282d95
Scope the DigitalWorker preview feature to Digital Worker requests, validate Digital Worker-only publish fields in schema, and use BotServiceTenant for Digital Worker activity endpoints.

Digital Worker deploy now declares digital_worker_type=m365, so the endpoint authorization scheme must also use the tenant-based Digital Worker path. Leaving BotServiceRbac on the endpoint causes the runtime to call Azure Authorization checkaccess during user conversations, which fails for Agent 365 instances.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
20 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns Digital Worker deployment and Microsoft 365 publishing with the service-side m365 contract.

Changes:

  • Selects tenant authorization for Digital Worker endpoints.
  • Adds service-side type reconciliation and preview headers.
  • Adds permission-scope/access-boundary configuration, flags, validation, and tests.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
schemas/azure.ai.agent.json Updates Digital Worker schema.
README.md Documents configuration and flags.
internal/project/service_target_agent.go Updates deployment and endpoint authorization.
internal/project/service_target_agent_test.go Tests endpoint authorization selection.
internal/project/doc_examples_test.go Tests documented schema fields.
internal/project/config.go Adds publish configuration types.
internal/project/activity_profile.go Reconciles and validates Digital Worker profiles.
internal/project/activity_profile_test.go Tests profile resolution and validation.
internal/pkg/agents/agent_api/operations.go Scopes preview headers to API operations.
internal/pkg/agents/agent_api/operations_test.go Tests request headers and payloads.
internal/pkg/agents/agent_api/models.go Adds Digital Worker API fields.
internal/pkg/agents/agent_api/models_test.go Tests model serialization.
internal/pkg/agents/agent_api/microsoft365.go Updates Microsoft 365 request contract.
internal/pkg/agents/agent_api/microsoft365_test.go Tests publish contract and tri-state boundaries.
internal/cmd/teams_pack.go Uses deployed service classification.
internal/cmd/teams_pack_test.go Tests Digital Worker package requests.
internal/cmd/publish.go Adds publish flags and input resolution.
internal/cmd/publish_test.go Tests new publish inputs.
internal/cmd/listen_activity_test.go Updates Digital Worker fixtures.
CHANGELOG.md Adds the change to release history.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/CHANGELOG.md Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/publish.go Outdated
@github-actions

Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Thank you for logging this issue; our team is reviewing it. If you need urgent prioritization, tag Rick Winter (@RickWinter) and Kristen Womack (@kristenwomack) to let us know.

Copilot AI review requested due to automatic review settings August 31, 2026 02:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated no new comments.

Suppressed comments (3)

cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go:1569

  • ResolveDeployedActivityProfile can promote a locally simple Activity agent to digital_worker from the service response, but result.request.AgentEndpoint still contains the BotServiceRbac scheme chosen earlier from local configuration. The subsequent patch therefore restores RBAC on a service-classified M365 worker and reproduces the checkaccess failure this change targets. Reconcile the endpoint scheme from the resolved profile before patching it.
	activityProfile, err = ResolveDeployedActivityProfile(activityProfile, deployedVersion.DigitalWorkerType)

cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go:3060

  • Clearing DigitalWorkerType makes migration impossible for an existing code-deployed agent created under the old contract. Such an agent has no service-side type; this update omits the only new classification field, and the post-deploy reconciliation then fails on the still-empty type. Retrying azd deploy repeats the same update path, so either update the classification through a supported API or fail before upload with an actionable delete/recreate migration.
		updateVersionRequest.DigitalWorkerType = ""

cli/azd/extensions/azure.ai.agents/CHANGELOG.md:7

  • This adds the open PR to the already released 1.0.0-beta.13 (2026-08-27) section, making release history claim the change shipped before it merged. Per cli/azd/AGENTS.md:253-259 and this extension's release process in cli/azd/extensions/azure.ai.agents/AGENTS.md:164-172, defer this entry to the release/version-bump PR.
- [[#9776]](https://github.com/Azure/azure-dev/pull/9776) Update Digital Worker agent and Microsoft 365 publish contracts with service-side type detection, optional permission scopes, and access boundaries.

Copilot AI review requested due to automatic review settings August 31, 2026 02:57
@jayzhang Huajie Zhang (jayzhang) changed the title fix(azure.ai.agents): align digital worker endpoint auth feat(azure.ai.agents): update digital worker contracts Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Comment thread cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/operations.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/publish.go
Copilot AI review requested due to automatic review settings August 31, 2026 03:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

cli/azd/extensions/azure.ai.agents/internal/cmd/publish.go:228

  • Configured boundaries are validated after trimming, but this copy preserves the original whitespace and sends it to Microsoft 365. For example, " read.1on1.developers " passes runtime validation and then produces an unsupported wire value. Normalize these values just like permission scopes and CLI boundary values.
		if publish.AccessBoundaries != nil {
			values := make([]string, len(*publish.AccessBoundaries))
			copy(values, *publish.AccessBoundaries)
			boundaries = &values

cli/azd/extensions/azure.ai.agents/internal/project/direct_deploy.go:309

  • A deployed Digital Worker can resolve to an Activity profile while the local standalone definition leaves agentEndpoint unset. This call then no-ops, so the deployed BotServiceRbac endpoint is never corrected to BotServiceTenant. Fall back to the endpoint returned by GetAgent before normalizing it, preserving its other protocols and schemes.
	EnsureActivityEndpointAuthSchemeForProfile(request.AgentEndpoint, resolvedProfile)

Copilot AI review requested due to automatic review settings September 1, 2026 09:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Replace activity.useCase with activity.digitalWorkerType in azure.yaml. Omitted values retain simple Activity behavior, while m365 maps to the service digital_worker_type contract. Reject the removed field to prevent silent fallback.

Authored-by: GitHub Copilot for VS Code

Model: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 1, 2026 13:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Comment thread cli/azd/extensions/azure.ai.agents/internal/project/activity_profile.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/schemas/azure.ai.agent.json
Reject Digital Worker-only permission scopes and access boundaries when digitalWorkerType is omitted, including explicitly empty arrays, so runtime validation matches the schema.

Authored-by: GitHub Copilot for VS Code

Model: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 1, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Comment thread cli/azd/extensions/azure.ai.agents/internal/project/direct_deploy.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/publish.go
Always read and reconcile the deployed Digital Worker classification for existing standalone agents. Normalize configured access boundaries before sending the Microsoft 365 publish request.

Authored-by: GitHub Copilot for VS Code

Model: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 1, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Comment thread cli/azd/extensions/azure.ai.agents/internal/project/activity_profile.go Outdated
Separate Activity classification from Digital Worker publish validation so publish flags can replace invalid configured values. Keep eager validation on deploy paths and cover the full publish resolution order.

Authored-by: GitHub Copilot for VS Code

Model: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 2, 2026 04:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Standalone reconciliation can leave legacy authorization unchanged when no local endpoint exists, and one immutable-type recovery message recommends an ineffective redeploy.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go:1577

  • digital_worker_type is immutable for container agents too, so a normal redeploy cannot resolve this mismatch; it only creates another version and the next reconciliation will fail again. Give the same delete/recreate guidance used by both update paths.
  • Files reviewed: 33/33 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Create a missing standalone endpoint before applying the deployed Digital Worker authorization profile. Direct all immutable digital worker type mismatches to delete and recreate the agent instead of retrying deployment.

Authored-by: GitHub Copilot for VS Code

Model: GitHub Copilot

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 2, 2026 05:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

YAML permission scopes are not grouped by resource application, and create/update reconciliation lacks direct coverage.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

cli/azd/extensions/azure.ai.agents/internal/cmd/publish.go:213

  • Configured permission scopes are copied one entry at a time, so repeated resourceAppId values in azure.yaml produce multiple payload entries for the same resource. The new contract requires scopes to be grouped by resource application, and the flag path already performs that grouping. Merge scopes by trimmed resource app ID here, or reject duplicate resource IDs during validation.
    cli/azd/extensions/azure.ai.agents/internal/project/service_target_agent.go:3521
  • The create/update reconciliation branch has no direct test coverage. Add transport-backed tests that verify a 404 retains DigitalWorkerType for creation, an existing matching agent clears the immutable field for version updates, mismatches are rejected, and non-404 failures propagate; otherwise regressions can silently drop classification on create or resend it on update.
  • Files reviewed: 33/33 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@azure-sdk-automation

Copy link
Copy Markdown
Contributor

azure.ai.agents PR build

Note

This is an unsigned development build. Install it only if you trust this PR.

Install the extension:

azd ext install "https://azuresdkartifacts.z5.web.core.windows.net/azd/extensions/pr/9789/azure-ai-agents.zip"
  • Version: 1.0.0-beta.13.pr.9789.6776230
  • Merge commit: 80cb357

@jayzhang
Huajie Zhang (jayzhang) merged commit a50f322 into main Sep 2, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ext-agents azure.ai.agents extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adapt azure.ai.agents to the updated Digital Worker contracts

6 participants