-
Notifications
You must be signed in to change notification settings - Fork 184
Add app config and related feature flag capabilities #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 16 commits
7af05c8
b399a51
0f456b4
bb08f51
371b4c3
c2b3b63
19abd4c
ba41c7c
c96b5f3
3fe9f12
e4e1de1
f8bb98c
0616a36
7fe4ce1
cd2e117
bc4981b
7466a59
dc5f9ec
7f3c217
8e10baa
968db30
b34f52c
4d8c058
c880263
d78639d
f32ea57
27d3a59
94d9ffe
5c847fd
dc4e590
027181d
a989dbc
5d26938
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"schemaVersion": "2.0.0", | ||
"feature_management": { | ||
"feature_flags": [ | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"schemaVersion": "2.0.0", | ||
"feature_management": { | ||
"feature_flags": [ | ||
{ | ||
"id": "my-agent", | ||
"enabled": true, | ||
"variants": [ | ||
{ | ||
"name": "agent_v1", | ||
"configuration_value": "<agent-id-1-placeholder>" | ||
}, | ||
{ | ||
"name": "agent_v2", | ||
"configuration_value": "<agent-id-2-placeholder>" | ||
} | ||
], | ||
"allocation": { | ||
"percentile": [ | ||
{ | ||
"variant": "agent_v1", | ||
"from": 0, | ||
"to": 50 | ||
}, | ||
{ | ||
"variant": "agent_v2", | ||
"from": 50, | ||
"to": 100 | ||
} | ||
], | ||
"default_when_enabled": "agent_v1", | ||
"default_when_disabled": "agent_v1" | ||
}, | ||
"telemetry": { | ||
"enabled": true | ||
} | ||
} | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Validate Experiments | ||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
# GitHub Actions workflow to deploy to Azure using azd | ||
# To configure required secrets for connecting to Azure, simply run `azd pipeline config` | ||
|
||
# Set up permissions for deploying with secretless Azure federated credentials | ||
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
APP_CONFIGURATION_FILE: .config/feature-flags.json | ||
|
||
jobs: | ||
validate-feature-flags: | ||
name: Validate Feature Flags | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Validate App Config feature flags | ||
uses: azure/app-configuration-deploy-feature-flags@v1-beta | ||
with: | ||
path: ${{ env.APP_CONFIGURATION_FILE }} | ||
operation: validate | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ ENV/ | |
env.bak/ | ||
venv.bak/ | ||
.azure | ||
.vscode/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
@description('Name of Azure App Configuration store') | ||
param configStoreName string | ||
|
||
@description('The principal ID of the service principal to assign the role to') | ||
param principalId string | ||
@description('The principal ID of the application that needs read access to the Azure App Configuration store') | ||
param appPrincipalId string | ||
|
||
@description('The principal ID of the service principal that needs to manage the Azure App Configuration store') | ||
param userPrincipalId string | ||
|
||
resource configStore 'Microsoft.AppConfiguration/configurationStores@2023-03-01' existing = { | ||
name: configStoreName | ||
} | ||
|
||
var configStoreDataReaderRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '516239f1-63e1-4d78-a4de-a74fb236a071') | ||
var configStoreDataOwnerRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '5ae67dd6-50cb-40e7-96ff-dc2bfa4b606b') | ||
|
||
resource configStoreDataReaderRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(subscription().id, resourceGroup().id, principalId, configStoreDataReaderRole) | ||
name: guid(subscription().id, resourceGroup().id, appPrincipalId, configStoreDataReaderRole) | ||
scope: configStore | ||
properties: { | ||
roleDefinitionId: configStoreDataReaderRole | ||
principalId: principalId | ||
principalType: 'ServicePrincipal' | ||
principalId: appPrincipalId | ||
} | ||
} | ||
|
||
resource configStoreDataOwnerRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
name: guid(resourceGroup().id, userPrincipalId, configStoreDataOwnerRole) | ||
scope: configStore | ||
properties: { | ||
roleDefinitionId: configStoreDataOwnerRole | ||
principalId: userPrincipalId | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,8 +108,11 @@ param useApplicationInsights bool = true | |
@description('Do we want to use the Azure AI Search') | ||
param useSearchService bool = false | ||
|
||
@description('Id of the user or app to assign application roles') | ||
param principalId string = '' | ||
|
||
@description('Random seed to be used during generation of new resources suffixes.') | ||
param seed string = newGuid() | ||
param seed string = newGuid() // why do we need this? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we want this? Sometimes when there is an issue, I do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, this is strange. I created an issue in this repo about it |
||
|
||
var abbrs = loadJsonContent('./abbreviations.json') | ||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location, seed)) | ||
|
@@ -388,6 +391,20 @@ module backendRoleAzureAIDeveloperRG 'core/security/role.bicep' = { | |
} | ||
} | ||
|
||
// App Configuration | ||
module configStore 'core/config/configstore.bicep' = { | ||
name: 'config-store' | ||
scope: rg | ||
params: { | ||
location: location | ||
name: '${abbrs.appConfigurationStores}${resourceToken}' | ||
tags: tags | ||
appPrincipalId: api.outputs.SERVICE_API_IDENTITY_PRINCIPAL_ID | ||
userPrincipalId: principalId | ||
appInsightsName: ai.outputs.applicationInsightsName | ||
} | ||
} | ||
|
||
output AZURE_RESOURCE_GROUP string = rg.name | ||
|
||
// Outputs required for local development server | ||
|
@@ -401,6 +418,7 @@ output AZURE_AI_SEARCH_ENDPOINT string = searchServiceEndpoint | |
output AZURE_AI_EMBED_DIMENSIONS string = embeddingDeploymentDimensions | ||
output AZURE_AI_AGENT_NAME string = agentName | ||
output AZURE_AI_AGENT_ID string = agentID | ||
output APP_CONFIGURATION_ENDPOINT string = configStore.outputs.endpoint | ||
|
||
// Outputs required by azd for ACA | ||
output AZURE_CONTAINER_ENVIRONMENT_NAME string = containerApps.outputs.environmentName | ||
|
Uh oh!
There was an error while loading. Please reload this page.