Skip to content

Commit 0165a4c

Browse files
committed
Configure Azure Developer Pipeline
1 parent e7e1651 commit 0165a4c

File tree

9 files changed

+18
-13
lines changed

9 files changed

+18
-13
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This repository includes both the infrastructure and Python files needed so that
4141

4242
### Architecture diagram
4343

44-
![Architecture diagram: Microsoft Entra managed identity connecting to Azure AI services](./diagram.png)
44+
![Architecture diagram: Microsoft Entra managed identity connecting to Azure AI services](./readme_diagram.png)
4545

4646
## Getting started
4747

@@ -132,12 +132,14 @@ A related option is VS Code Dev Containers, which will open the project in your
132132
133133
3. Run an example by running either `python example_file.py` or selecting the `Run` button on the opened file. Available examples:
134134
135-
* `extract_github_issue.py`: Fetches a public issue using the GitHub API, and then extracts details.
136-
* `extract_github_repo.py`: Fetches a public README using the GitHub API, and then extracts details.
137-
* `extract_image_graph.py`: Parses a local image of a graph and extracts details like title, axis, legend.
138-
* `extract_image_table.py`: Parses a local image with tables and extracts nested tabular data.
139-
* `extract_pdf_receipt.py`: Parses a local PDF using `pymupdf`, which converts it to Markdown, and extracts order details.
140-
* `extract_webpage.py`: Parses a blog post using `BeautifulSoup`, and extracts title, description, and tags.
135+
| Script filename | Description |
136+
|---------------------------|-----------------------------------------------------------------------------|
137+
| `extract_github_issue.py` | Fetches a public issue using the GitHub API, and then extracts details. |
138+
| `extract_github_repo.py` | Fetches a public README using the GitHub API, and then extracts details. |
139+
| `extract_image_graph.py` | Parses a local image of a graph and extracts details like title, axis, legend. |
140+
| `extract_image_table.py` | Parses a local image with tables and extracts nested tabular data. |
141+
| `extract_pdf_receipt.py` | Parses a local PDF using `pymupdf`, which converts it to Markdown, and extracts order details. |
142+
| `extract_webpage.py` | Parses a blog post using `BeautifulSoup`, and extracts title, description, and tags. |
141143
142144
## Guidance
143145

extract_github_issue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1717
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1818
exit(1)
19-
credential = azure.identity.DefaultAzureCredential()
19+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
2020
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2121
client = openai.AzureOpenAI(
2222
api_version="2024-08-01-preview",

extract_github_repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1818
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1919
exit(1)
20-
credential = azure.identity.DefaultAzureCredential()
20+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
2121
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2222
client = openai.AzureOpenAI(
2323
api_version="2024-08-01-preview",

extract_image_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1616
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1717
exit(1)
18-
credential = azure.identity.DefaultAzureCredential()
18+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
1919
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2020
client = openai.AzureOpenAI(
2121
api_version="2024-08-01-preview",

extract_image_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1616
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1717
exit(1)
18-
credential = azure.identity.DefaultAzureCredential()
18+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
1919
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2020
client = openai.AzureOpenAI(
2121
api_version="2024-08-01-preview",

extract_pdf_receipt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1616
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1717
exit(1)
18-
credential = azure.identity.DefaultAzureCredential()
18+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
1919
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2020
client = openai.AzureOpenAI(
2121
api_version="2024-08-01-preview",

extract_webpage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if not os.getenv("AZURE_OPENAI_SERVICE") or not os.getenv("AZURE_OPENAI_GPT_DEPLOYMENT"):
1717
logging.warning("AZURE_OPENAI_SERVICE and AZURE_OPENAI_GPT_DEPLOYMENT environment variables are empty. See README.")
1818
exit(1)
19-
credential = azure.identity.DefaultAzureCredential()
19+
credential = azure.identity.AzureDeveloperCliCredential(tenant_id=os.getenv("AZURE_TENANT_ID"))
2020
token_provider = azure.identity.get_bearer_token_provider(credential, "https://cognitiveservices.azure.com/.default")
2121
client = openai.AzureOpenAI(
2222
api_version="2024-08-01-preview",

infra/write_dot_env.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Set-Content -Path .env -Value ""
44
# Append new values to the .env file
55
$azureOpenAiDeployment = azd env get-value AZURE_OPENAI_GPT_DEPLOYMENT
66
$azureOpenAiService = azd env get-value AZURE_OPENAI_SERVICE
7+
$azureTenantId = azd env get-value AZURE_TENANT_ID
78

89
Add-Content -Path .env -Value "AZURE_OPENAI_GPT_DEPLOYMENT=$azureOpenAiDeployment"
910
Add-Content -Path .env -Value "AZURE_OPENAI_SERVICE=$azureOpenAiService"
11+
Add-Content -Path .env -Value "AZURE_TENANT_ID=$azureTenantId"

infra/write_dot_env.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
# Append new values to the .env file
77
echo "AZURE_OPENAI_GPT_DEPLOYMENT=$(azd env get-value AZURE_OPENAI_GPT_DEPLOYMENT)" >> .env
88
echo "AZURE_OPENAI_SERVICE=$(azd env get-value AZURE_OPENAI_SERVICE)" >> .env
9+
echo "AZURE_TENANT_ID=$(azd env get-value AZURE_TENANT_ID)" >> .env

0 commit comments

Comments
 (0)