You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add acquire_token() public method for cross-resource auth
Adds _AuthManager.acquire_token(resource_url) as a thin public helper over
the existing _acquire_token: appends /.default and delegates to the
underlying TokenCredential. Lets callers reuse the same credential to
obtain tokens for any Microsoft AAD-protected resource (notably a linked
Finance & Operations env) via client.auth.acquire_token(fno_url).
Internal _ODataClient._headers() now goes through the same method, so the
DV and external paths share one scope-construction site.
Verified end-to-end against a real F&O int env (operations.int.dynamics.com)
using AzureCliCredential: token issued with aud=<fno_url>, F&O accepted
the token and returned $metadata (HTTP 200, ~53 MB OData XML).
Tests: 4 new unit tests in tests/unit/core/test_auth.py (default-scope,
trailing-slash strip, alternate resource, empty-URL ValueError); _auth.py
coverage 100%. Inline DummyAuth in tests/conftest.py plus three test
modules updated to also expose acquire_token so _odata._headers callsites
keep passing. Full suite: 1393 passed.
Docs: README adds a subsection covering F&O token acquisition; both
SKILL.md copies updated (byte-identical per dataverse-sdk-dev contract);
CHANGELOG [Unreleased] entry added.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
### Acquiring Tokens for Other Microsoft Resources
71
+
72
+
`client.auth.acquire_token(resource_url)` returns an OAuth2 token from the same credential for any AAD-protected Microsoft resource (e.g. a linked Finance & Operations environment). The `/.default` scope is appended automatically.
73
+
74
+
```python
75
+
# Token for a linked Finance & Operations environment
The customer's AAD app must already have the required permission on the target resource. For F&O the standard delegated permissions are `Odata.FullAccess` and `CustomService.FullAccess` on the **Microsoft Dynamics ERP** API (`00000015-0000-0000-c000-000000000000`).
Copy file name to clipboardExpand all lines: CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
-`client.auth.acquire_token(resource_url)` -- acquire an OAuth2 access token for any Microsoft AAD-protected resource (for example a linked Finance & Operations environment) using the same credential the Dataverse client was constructed with. The `/.default` scope is appended automatically; token caching and refresh remain the credential's responsibility. The internal Dataverse request path now goes through the same method, removing the inline scope construction in `_ODataClient._headers()`.
> **Complete authentication setup**: See **[Use OAuth with Dataverse](https://learn.microsoft.com/power-apps/developer/data-platform/authenticate-oauth)** for app registration, all credential types, and security configuration.
114
114
115
+
#### Acquiring tokens for other Microsoft resources
116
+
117
+
The same credential can be used to acquire tokens for any Microsoft AAD-protected resource the caller has access to -- notably a Finance & Operations environment linked to the same Dataverse org. Use `client.auth.acquire_token(resource_url)` to obtain a token without constructing a second credential:
118
+
119
+
```python
120
+
# Token for a linked Finance & Operations environment
The `/.default` scope is appended automatically. The customer's AAD app must already have the required permission on the target resource and admin consent granted. For Finance & Operations the standard permissions are `Odata.FullAccess` and `CustomService.FullAccess` on the **Microsoft Dynamics ERP** API (`00000015-0000-0000-c000-000000000000`).
127
+
115
128
## Key concepts
116
129
117
130
The SDK provides a simple, pythonic interface for Dataverse operations:
### Acquiring Tokens for Other Microsoft Resources
71
+
72
+
`client.auth.acquire_token(resource_url)` returns an OAuth2 token from the same credential for any AAD-protected Microsoft resource (e.g. a linked Finance & Operations environment). The `/.default` scope is appended automatically.
73
+
74
+
```python
75
+
# Token for a linked Finance & Operations environment
The customer's AAD app must already have the required permission on the target resource. For F&O the standard delegated permissions are `Odata.FullAccess` and `CustomService.FullAccess` on the **Microsoft Dynamics ERP** API (`00000015-0000-0000-c000-000000000000`).
0 commit comments