Skip to content

Commit

Permalink
Merge pull request #10 from Azure-Samples/githubdocs
Browse files Browse the repository at this point in the history
Fix principal for GitHub actions workflow
  • Loading branch information
pamelafox authored Oct 11, 2024
2 parents 2337be9 + d4de27d commit 4430d20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ param gptDeploymentCapacity int = 30
@description('Id of the user or app to assign application roles')
param principalId string = ''

@description('Non-empty if the deployment is running on GitHub Actions')
param runningOnGitHub string = ''

var principalType = empty(runningOnGitHub) ? 'User' : 'ServicePrincipal'

var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
var prefix = '${environmentName}${resourceToken}'
var tags = { 'azd-env-name': environmentName }
Expand Down Expand Up @@ -97,7 +102,7 @@ module openAi 'br/public:avm/res/cognitive-services/account:0.7.1' = {
{
principalId: principalId
roleDefinitionIdOrName: 'Cognitive Services OpenAI User'
principalType: 'User'
principalType: principalType
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
},
"principalId": {
"value": "${AZURE_PRINCIPAL_ID}"
},
"runningOnGitHub": {
"value": "${GITHUB_ACTIONS}"
}
}
}

0 comments on commit 4430d20

Please sign in to comment.