Skip to content

Commit b345a35

Browse files
Merge pull request #65 from microsoft/dev
chore: dev to main merge
2 parents 0593465 + 0f2d2a3 commit b345a35

17 files changed

Lines changed: 130 additions & 41 deletions

.github/workflows/azd-ai-template-validation.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
name: AZD AI Template validation
2-
# Run when commits are pushed to pre-deploy-alguadam
2+
33
on:
4-
push:
5-
branches:
6-
- main
7-
- dev
8-
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
paths:
9+
- 'infra/**'
10+
- 'src/**'
11+
- 'azure.yaml'
12+
- '.github/workflows/azd-ai-template-validation.yml'
13+
workflow_dispatch:
14+
schedule:
15+
- cron: '30 1 * * 4' # Every Thursday 7:00 AM IST / 1:30 AM UTC
916

1017
# Set up permissions for deploying with secretless Azure federated credentials
1118
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
1219
permissions:
1320
id-token: write
1421
contents: read
1522

23+
env:
24+
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
25+
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
26+
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
27+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
28+
RG_TAGS: ${{ vars.RG_TAGS }}
29+
TEMPLATE_USE_DEV_CONTAINER: ${{ vars.TEMPLATE_USE_DEV_CONTAINER }}
30+
TEMPLATE_VALIDATE_AZD: ${{ vars.TEMPLATE_VALIDATE_AZD }}
31+
TEMPLATE_VALIDATE_TESTS: ${{ vars.TEMPLATE_VALIDATE_TESTS }}
32+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
33+
1634
jobs:
1735
validate:
1836
runs-on: ubuntu-latest
1937
name: Validation steps
2038
environment: 'rti-validate'
21-
env:
22-
RG_TAGS: ${{ vars.RG_TAGS }}
2339
steps:
2440
- name: Checkout
2541
uses: actions/checkout@v4
2642

43+
- name: Set timestamp
44+
shell: bash
45+
run: echo "HHMM=$(date -u +'%H%M')" >> $GITHUB_ENV
46+
2747
- name: Add RG tags into Bicep parameter file
2848
shell: bash
2949
run: |
@@ -45,11 +65,15 @@ jobs:
4565
uses: microsoft/template-validation-action@Latest
4666
id: validation
4767
env:
48-
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
49-
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
50-
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
51-
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
52-
AZURE_ENV_NAME: '${{ vars.AZURE_ENV_NAME }}val'
68+
AZURE_CLIENT_ID: ${{ env.AZURE_CLIENT_ID }}
69+
AZURE_TENANT_ID: ${{ env.AZURE_TENANT_ID }}
70+
AZURE_SUBSCRIPTION_ID: ${{ env.AZURE_SUBSCRIPTION_ID }}
71+
AZURE_LOCATION: ${{ env.AZURE_LOCATION }}
72+
AZURE_ENV_NAME: azd-${{ vars.AZURE_ENV_NAME }}-${{ env.HHMM }}
73+
TEMPLATE_USE_DEV_CONTAINER: ${{ env.TEMPLATE_USE_DEV_CONTAINER }}
74+
TEMPLATE_VALIDATE_AZD: ${{ env.TEMPLATE_VALIDATE_AZD }}
75+
TEMPLATE_VALIDATE_TESTS: ${{ env.TEMPLATE_VALIDATE_TESTS }}
76+
AZURE_DEV_COLLECT_TELEMETRY: ${{ env.AZURE_DEV_COLLECT_TELEMETRY }}
5377
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5478

5579
- name: Print result

.github/workflows/azure-dev.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
name: CI/CD Azure - Real-Time Intelligence Operations
22

3-
# Trigger the workflow on push to main/master or manual dispatch
3+
# Trigger the workflow on manual dispatch
44
on:
55
workflow_dispatch:
66
push:
77
branches:
88
- main
99
- dev
10-
# - "*"
11-
# paths:
12-
# - "infra/**"
13-
# - "src/**"
14-
# - ".github/workflows/azure-dev.yml"
15-
# pull_request:
16-
# branches:
17-
# - main
18-
# paths:
19-
# - "infra/**"
20-
# - "src/**"
21-
# - ".github/workflows/azure-dev.yml"
10+
paths:
11+
- 'infra/**'
12+
- 'src/**'
13+
- 'azure.yaml'
14+
- 'requirements.txt'
15+
- '.github/workflows/azure-dev.yml'
16+
pull_request:
17+
branches:
18+
- main
19+
paths:
20+
- 'infra/**'
21+
- 'src/**'
22+
- 'azure.yaml'
23+
- 'requirements.txt'
24+
- '.github/workflows/azure-dev.yml'
2225

2326
# Set up permissions for deploying with secretless Azure federated credentials
2427
permissions:
@@ -32,6 +35,10 @@ env:
3235
AZURE_LOCATION: 'westus3'
3336
PYTHONIOENCODING: utf-8
3437
RG_TAGS: ${{ vars.RG_TAGS }}
38+
TEMPLATE_USE_DEV_CONTAINER: ${{ vars.TEMPLATE_USE_DEV_CONTAINER }}
39+
TEMPLATE_VALIDATE_AZD: ${{ vars.TEMPLATE_VALIDATE_AZD }}
40+
TEMPLATE_VALIDATE_TESTS: ${{ vars.TEMPLATE_VALIDATE_TESTS }}
41+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
3542

3643
jobs:
3744
build:
@@ -90,9 +97,10 @@ jobs:
9097
shell: bash
9198
run: |
9299
COMMON_PART="rtio"
100+
HHMM=$(date -u +'%H%M')
93101
TIMESTAMP=$(date +%s)
94-
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 6)
95-
UNIQUE_ENV_NAME="${COMMON_PART}${UPDATED_TIMESTAMP}"
102+
UPDATED_TIMESTAMP=$(echo "$TIMESTAMP" | tail -c 6)
103+
UNIQUE_ENV_NAME="${COMMON_PART}${HHMM}${UPDATED_TIMESTAMP}"
96104
echo "ENV_NAME=${UNIQUE_ENV_NAME}" >> $GITHUB_ENV
97105
echo "Generated Environment Name: ${UNIQUE_ENV_NAME}"
98106

.github/workflows/pylint.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
name: PyLint
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- 'src/**/*.py'
7+
- 'infra/**/*.py'
8+
- 'requirements.txt'
9+
- '.github/workflows/pylint.yml'
10+
pull_request:
11+
paths:
12+
- 'src/**/*.py'
13+
- 'infra/**/*.py'
14+
- 'requirements.txt'
15+
- '.github/workflows/pylint.yml'
416

517
jobs:
618
build:

azure.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ metadata:
55
template: real-time-intelligence-operations-solution-accelerator@1.0
66

77
requiredVersions:
8-
azd: ">= 1.19.0"
8+
azd: ">= 1.19.0 != 1.23.9"
9+
bicep: '>= 0.33.0'
910

1011
hooks:
1112
postprovision:

docs/FabricDataAgentGuide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ After you have deployed your solution, you can add Azure Data Agent to get data
66
- Add the KQL Database created in the Fabric workspace as your data source,
77
- Use the Agent configuration files provided below to set up your Fabric Data Agent.
88

9+
> [!NOTE]
10+
> The Fabric Data Agent SDK is currently in **Preview**. After deployment, table selections may not persist — you may need to manually select the required tables in the Fabric portal under the **Data** tab and save. Once saved through the UI, the selections persist and the agent works as expected.
11+
>
12+
> ![Data Agent - Tables Selected](../docs/images/deployment/data_agent_tables_selected.png)
13+
914
## 📁 Agent Configuration Files
1015

1116
This folder contains essential configuration files for setting up your Fabric Data Agent to deliver optimal intelligence based on your data.
104 KB
Loading

infra/main.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ var allTags = union(
102102
tags
103103
)
104104

105+
var eventHubTags = union(allTags, {
106+
SecurityControl: 'Ignore' // Required to override MSFT subscription policy controls that enforce disableLocalAuth; local auth needed for Fabric SAS connection
107+
})
108+
105109
resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
106110
name: 'default'
107111
properties: {
@@ -142,6 +146,7 @@ module eventHubNamespaceModule 'br/public:avm/res/event-hub/namespace:0.13.0' =
142146
skuName: 'Standard'
143147
skuCapacity: 1
144148
disableLocalAuth: false // NOTE: local auth is currently needed in order to create connection with Fabric via SAS token
149+
tags: eventHubTags
145150
eventhubs: [
146151
{
147152
name: eventHubName

infra/main.parameters.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
},
1111
"existingFabricCapacityName": {
1212
"value": "${EXISTING_FABRIC_CAPACITY_NAME}"
13+
},
14+
"tags": {
15+
"value": "${AZURE_TAGS}"
1316
}
1417
}
1518
}

infra/scripts/fabric/fabric_activator_definition.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import os
3333
import re
3434
import sys
35-
from typing import Dict, Any, Optional
3635

3736
from fabric_api import FabricWorkspaceApiClient, FabricApiError
3837

infra/scripts/fabric/fabric_api.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ def _format_duration(self, elapsed_seconds: float) -> str:
8686
minutes = int(elapsed_seconds // 60)
8787
seconds = int(elapsed_seconds % 60)
8888
return f"{minutes}m {seconds}s"
89+
90+
@staticmethod
91+
def _normalize_eventhub_endpoint(namespace_or_endpoint: str) -> str:
92+
"""Normalize Event Hub endpoint to the connector-expected host format.
93+
94+
Accepts either a bare namespace (e.g. "myns") or a full endpoint
95+
(e.g. "sb://myns.servicebus.windows.net/") and returns
96+
"myns.servicebus.windows.net".
97+
"""
98+
endpoint = (namespace_or_endpoint or "").strip()
99+
if endpoint.startswith("sb://"):
100+
endpoint = endpoint[len("sb://"):]
101+
endpoint = endpoint.rstrip("/")
102+
if ".servicebus.windows.net" not in endpoint:
103+
endpoint = f"{endpoint}.servicebus.windows.net"
104+
return endpoint
89105

90106
def start_long_running_operation(self,
91107
uri: str,
@@ -759,6 +775,8 @@ def create_eventhub_connection(self, name: str, namespace_name: str, event_hub_n
759775
"""
760776
self._log(f"Creating Event Hub connection: {name}")
761777

778+
normalized_endpoint = self._normalize_eventhub_endpoint(namespace_name)
779+
762780
connection_payload = {
763781
"displayName": name,
764782
"connectivityType": "ShareableCloud",
@@ -770,7 +788,7 @@ def create_eventhub_connection(self, name: str, namespace_name: str, event_hub_n
770788
{
771789
"name": "endpoint",
772790
"dataType": "Text",
773-
"value": namespace_name,
791+
"value": normalized_endpoint,
774792
},
775793
{
776794
"name": "entityPath",
@@ -780,6 +798,7 @@ def create_eventhub_connection(self, name: str, namespace_name: str, event_hub_n
780798
]
781799
},
782800
"credentialDetails": {
801+
"singleSignOnType": "None",
783802
"credentials": {
784803
"credentialType": "Basic", # the endpoint only accepts Basic auth, but takes SAS key with policy name as password and username
785804
"username": shared_access_policy_name, #"RootManageSharedAccessKey",
@@ -818,11 +837,30 @@ def update_eventhub_connection(self, connection_id: str, name: str, namespace_na
818837
try:
819838
self._log(f"Updating Event Hub connection: {name} (ID: {connection_id})")
820839

840+
normalized_endpoint = self._normalize_eventhub_endpoint(namespace_name)
841+
821842
connection_payload = {
822843
"displayName": name,
823844
"connectivityType": "ShareableCloud",
824845
"allowConnectionUsageInGateway": False,
846+
"connectionDetails": {
847+
"type": "EventHub",
848+
"creationMethod": "EventHub.Contents",
849+
"parameters": [
850+
{
851+
"name": "endpoint",
852+
"dataType": "Text",
853+
"value": normalized_endpoint,
854+
},
855+
{
856+
"name": "entityPath",
857+
"dataType": "Text",
858+
"value": event_hub_name,
859+
}
860+
]
861+
},
825862
"credentialDetails": {
863+
"singleSignOnType": "None",
826864
"credentials": {
827865
"credentialType": "Basic", # the endpoint only accepts Basic auth, but takes SAS key with policy name as password and username
828866
"username": shared_access_policy_name,

0 commit comments

Comments
 (0)