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: articles/ai-foundry/agents/how-to/tools/fabric.md
+24-23Lines changed: 24 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ You can add the Microsoft Fabric tool to an agent programmatically using the cod
65
65
:::image type="content" source="../../media\tools\fabric-foundry.png" alt-text="A screenshot showing the fabric connection in the Azure AI Foundry portal." lightbox="../../media\tools\fabric-foundry.png":::
66
66
67
67
:::zone-end
68
-
<!--
68
+
69
69
:::zone pivot="python"
70
70
71
71
## Create a project client
@@ -74,18 +74,17 @@ Create a client object, which will contain the connection string for connecting
74
74
75
75
```python
76
76
import os
77
-
from azure.identity import DefaultAzureCredential
78
77
from azure.ai.projects import AIProjectClient
79
-
from azure.ai.agents.models import FabricTool
78
+
from azure.identity import DefaultAzureCredential
79
+
from azure.ai.agents.models import FabricTool, ListSortOrder
80
80
81
81
# Retrieve the endpoint and credentials
82
82
project_endpoint = os.environ["PROJECT_ENDPOINT"] # Ensure the PROJECT_ENDPOINT environment variable is set
83
83
84
84
# Initialize the AIProjectClient
85
85
project_client = AIProjectClient(
86
-
endpoint=project_endpoint,
87
-
credential=DefaultAzureCredential(exclude_interactive_browser_credential=False), # Use Azure Default Credential for authentication
Use this article to find step-by-step instructions and code samples for using the SharePoint tool in Azure AI Foundry Agent Service.
22
22
23
+
:::zone pivot="python"
24
+
25
+
26
+
## Create a project client
27
+
28
+
Create a client object, which will contain the connection string for connecting to your AI project and other resources.
29
+
30
+
```python
31
+
import os
32
+
from azure.ai.projects import AIProjectClient
33
+
from azure.identity import DefaultAzureCredential
34
+
from azure.ai.agents.models import SharepointTool
35
+
36
+
# Retrieve the endpoint and credentials
37
+
project_endpoint = os.environ["PROJECT_ENDPOINT"] # Ensure the PROJECT_ENDPOINT environment variable is set
38
+
39
+
# Initialize the AIProjectClient
40
+
project_client = AIProjectClient(
41
+
endpoint=os.environ["PROJECT_ENDPOINT"],
42
+
credential=DefaultAzureCredential(),
43
+
)
44
+
```
45
+
46
+
## Create an agent with the Sharepoint tool enabled
47
+
48
+
To make the Microsoft Fabric tool available to your agent, use a connection to initialize the tool and attach it to the agent. You can find your connection in the **connected resources** section of your project in the Azure AI Foundry portal.
49
+
50
+
```python
51
+
# The Fabric connection id can be found in the Azure AI Foundry project as a property of the Fabric tool
52
+
# Your connection id is in the format /subscriptions/<your-subscription-id>/resourceGroups/<your-resource-group>/providers/Microsoft.MachineLearningServices/workspaces/<your-project-name>/connections/<your-fabric-connection-name>
53
+
54
+
# Retrieve the Fabric connection ID from environment variables
55
+
conn_id = os.environ["SHAREPOINT_CONNECTION_ID"] # Ensure the environment variable is set
Follow the [REST API Quickstart](../../quickstart.md?pivots=rest-api#api-call-information) to set the right values for the environment variables `AGENT_TOKEN`, `AZURE_AI_FOUNDRY_PROJECT_ENDPOINT` and `API_VERSION`.
0 commit comments