Skip to content

fix azd deploy pipeline #292

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 29 additions & 10 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Deploy to Azure
on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -35,9 +36,11 @@ env:
AZURE_REDIS_CACHE: ${{ vars.AZURE_REDIS_CACHE }}
AZURE_REDIS_CACHE_RESOURCE_GROUP: ${{ vars.AZURE_REDIS_CACHE_RESOURCE_GROUP }}
AZURE_PRINCIPAL_TYPE: 'ServicePrincipal'
dotEnvString: ${{ secrets.DOTENVSTRING }}

jobs:
build:
environment: azure-search
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/azure-dev-cli-apps:latest
Expand All @@ -64,6 +67,9 @@ jobs:
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID" --debug
shell: pwsh
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}

- name: Log in with Azure (Client Credentials)
if: ${{ env.AZURE_CREDENTIALS != '' }}
Expand All @@ -78,18 +84,31 @@ jobs:
shell: pwsh
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
- name: create azure-search-csharp env
run: |
azd env new azure-search-csharp

- name: Provision Infrastructure
run: azd provision --no-prompt --debug
- name: write each variable from .env using azd env set
run: |
$envs = $Env:dotEnvString -split "\n"
foreach ($env in $envs) {
echo $env
$keyValue = $env -split "="
$keyName = $keyValue[0]

# keyvalue will be the second element without quotes
$keyValue = $keyValue[1].Trim('"')
azd env set $keyName $keyValue
}

# cat .env
azd env get-values
shell: pwsh
env:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
AZURE_TAGS: ${{ secrets.AZURE_TAGS }}
dotEnvString: ${{ secrets.DOTENVSTRING }}

- name: Provision Infrastructure
run: azd provision --no-prompt

- name: Deploy Application
run: azd deploy --no-prompt --debug
env:
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
2 changes: 1 addition & 1 deletion infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ param webImageName string = ''
param useAOAI bool

@description('OpenAI API Key')
param openAIApiKey string
param openAIApiKey string = ''

@description('OpenAI Model')
param openAiChatGptDeployment string
Expand Down