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
Copy file name to clipboardExpand all lines: sdk/contentunderstanding/azure-ai-contentunderstanding/samples/async_samples/sample_grant_copy_auth_async.py
+86-38Lines changed: 86 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -9,17 +9,45 @@
9
9
10
10
DESCRIPTION:
11
11
This sample demonstrates how to grant copy authorization and copy an analyzer from a source
12
-
resource to a target resource (cross-resource copying). This is useful for copying analyzers
13
-
between different Azure resources or subscriptions.
12
+
Microsoft Foundry resource to a target Microsoft Foundry resource (cross-resource copying).
13
+
This is useful for copying analyzers between different Azure resources or subscriptions.
14
14
15
-
The grant_copy_authorization and copy_analyzer APIs allow you to copy an analyzer between
16
-
different Azure resources:
15
+
ABOUT CROSS-RESOURCE COPYING:
16
+
The `grant_copy_authorization` and `copy_analyzer` APIs allow you to copy an analyzer
17
+
between different Azure resources:
17
18
- Cross-resource copy: Copies an analyzer from one Azure resource to another
18
19
- Authorization required: You must grant copy authorization before copying
19
-
- Use cases: Cross-subscription copying, resource migration, multi-region deployment
20
20
21
-
Note: For same-resource copying (copying within the same Azure resource), use the
22
-
sample_copy_analyzer_async.py sample instead.
21
+
When to use cross-resource copying:
22
+
- Copy between subscriptions: Move analyzers between different Azure subscriptions
23
+
- Multi-region deployment: Deploy the same analyzer to multiple regions
24
+
- Resource migration: Migrate analyzers from one resource to another
25
+
- Environment promotion: Promote analyzers from development to production across resources
26
+
27
+
Note: For same-resource copying (copying within the same Microsoft Foundry resource),
28
+
use the sample_copy_analyzer_async.py sample instead.
29
+
30
+
PREREQUISITES:
31
+
To get started you'll need a **Microsoft Foundry resource**. For this cross-resource scenario,
32
+
you'll also need:
33
+
- Source Microsoft Foundry resource with model deployments configured
34
+
- Target Microsoft Foundry resource with model deployments configured
35
+
36
+
Important: Both the source and target resources require the 'Cognitive Services User' role
37
+
to be granted to the credential used to run the code. This role is required for cross-resource
38
+
copying operations. Without this role, the grant_copy_authorization and copy_analyzer
39
+
operations will fail with authorization errors.
40
+
41
+
HOW AUTHORIZATION WORKS:
42
+
The grant_copy_authorization method must be called on the source Microsoft Foundry resource
43
+
(where the analyzer currently exists). This is because the source resource needs to explicitly
44
+
grant permission for its analyzer to be copied. The method creates a time-limited authorization
45
+
record that grants permission to a specific target resource.
46
+
47
+
Where copy is performed: The copy_analyzer method must be called on the target Microsoft Foundry
48
+
resource (where the analyzer will be copied to). This is because the target resource is the one
49
+
receiving and creating the copy. When the target resource calls copy_analyzer, the service
50
+
validates that authorization was previously granted by the source resource.
0 commit comments