Skip to content

Commit

Permalink
Merge branch 'feature_managed_Identities' of https://github.com/micro…
Browse files Browse the repository at this point in the history
…soft/azurechat into feature_managed_Identities
  • Loading branch information
David Watson committed Feb 13, 2025
2 parents 57357c0 + 53d4f12 commit f21a65e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/open-ai-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ jobs:
node-version: "20.x"

- name: ⬇️ Download artifact from build job
uses: actions/download-artifact@v4
uses: actions/download-artifact@v4.1.8
with:
name: Nextjs-site

- name: 🗝️ Azure Login
uses: azure/login@v1
uses: azure/login@v2.2.0
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

# Set the build during deployment setting to false. This setting was added in the templates to all azd to work, but breaks deployment via webapps-deploy
- name: Azure CLI script
uses: azure/CLI@v1
uses: azure/CLI@v2.1.0
with:
inlineScript: |
rg=$(az webapp list --query "[?name=='${{ secrets.AZURE_APP_SERVICE_NAME }}'].resourceGroup" --output tsv)
Expand All @@ -91,7 +91,7 @@ jobs:
- name: 🚀 Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
uses: azure/webapps-deploy@v3.0.1
with:
app-name: ${{ secrets.AZURE_APP_SERVICE_NAME }}
package: ${{ github.workspace }}/Nextjs-site.zip
Expand Down
6 changes: 4 additions & 2 deletions src/features/auth-page/auth-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ const configureIdentityProvider = () => {
clientSecret: process.env.AZURE_AD_CLIENT_SECRET!,
tenantId: process.env.AZURE_AD_TENANT_ID!,
async profile(profile) {
const email = profile.email || profile.preferred_username || "";
const newProfile = {
...profile,
email,
// throws error without this - unsure of the root cause (https://stackoverflow.com/questions/76244244/profile-id-is-missing-in-google-oauth-profile-response-nextauth)
id: profile.sub,
isAdmin:
adminEmails?.includes(profile.email.toLowerCase()) ||
adminEmails?.includes(profile.preferred_username.toLowerCase()),
adminEmails?.includes(profile.email?.toLowerCase()) ||
adminEmails?.includes(profile.preferred_username?.toLowerCase()),
};
return newProfile;
},
Expand Down

0 comments on commit f21a65e

Please sign in to comment.