Skip to content

Commit ce18a9c

Browse files
committed
Cleanup and Down script to delete entra app
1 parent a9ee64b commit ce18a9c

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

app/indexer/microservice/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ COPY microservice microservice
1313
RUN chmod +x ./mvnw
1414
# Convert CRLF to LF
1515
RUN sed -i 's/\r$//' ./mvnw
16-
# Added -P dev for testing purposes
1716
RUN ./mvnw package -DskipTests
1817
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../../microservice/target/*.jar)
1918

deploy/aks/azure.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,10 @@ hooks:
5858
shell: pwsh
5959
run: ./scripts/easyauth.ps1
6060
interactive: true
61+
continueOnError: false
62+
postdown:
63+
windows:
64+
shell: pwsh
65+
run: ./scripts/easyauth-down.ps1
66+
interactive: true
6167
continueOnError: false

deploy/aks/scripts/easyauth-down.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
$output = azd env get-values
2+
3+
foreach ($line in $output) {
4+
if (!$line.Contains('=')) {
5+
continue
6+
}
7+
8+
$name, $value = $line.Split("=")
9+
$value = $value -replace '^\"|\"$'
10+
[Environment]::SetEnvironmentVariable($name, $value)
11+
}
12+
13+
if($Env:AZURE_USE_EASY_AUTH -eq "true"){
14+
Write-Host "Enabled EasyAuth for the AKS Cluster"
15+
} else {
16+
exit 1;
17+
}
18+
19+
Write-Host "Deleting Entra App ${Env:adAppName}:${Env:AZURE_AD_APP_ID}"
20+
21+
az ad app delete --id "{$Env:AZURE_AD_APP_ID}"

deploy/aks/scripts/easyauth.ps1

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,6 @@ $appCreationResult = az ad app create --display-name $adAppName --web-home-page-
8383
$appId = $appCreationResult | Select-Object -ExpandProperty appId
8484
Write-Host "Created Azure AD application with appId: $appId"
8585

86-
# Retrieve the object ID of the created application
87-
$appInfo = az ad app show --id $appId -o json | ConvertFrom-Json
88-
$objectId = $appInfo | Select-Object -ExpandProperty id
89-
Write-Host "Retrieved object ID: $objectId"
90-
91-
# Update the application to disable the first OAuth2Permission
92-
#Write-Host "Disabling the first OAuth2Permission"
93-
#az ad app update --id $appId --set oauth2Permissions[0].isEnabled=false
94-
# Clear the OAuth2Permissions array
95-
#az ad app update --id $appId --set oauth2Permissions=[]
96-
9786
# Reset credentials for the Azure AD application to generate a new password
9887
Write-Host "Resetting credentials for the Azure AD application"
9988
$credentialResetResult = az ad app credential reset --id $appId -o json | ConvertFrom-Json
@@ -131,11 +120,9 @@ kubectl get pods -n cert-manager
131120
# Deploy the issuer config to the cluster
132121
kubectl apply -f ./easyauth/cluster-issuer.yaml
133122

134-
$clientId = $appId
135-
136123
# ---------------------
137124
# Deploy Easy Auth Proxy
138-
helm install --set azureAd.tenantId=$azureTenantId --set azureAd.clientId=$clientId --set secret.name=easyauth-proxy-$adAppName-secret --set secret.azureclientsecret=$clientSecret --set appHostName=$appHostName --set tlsSecretName=$tlsSecretName easyauth-proxy ./easyauth/easyauth-proxy
125+
helm install --set azureAd.tenantId=$azureTenantId --set azureAd.clientId=$appId --set secret.name=easyauth-proxy-$adAppName-secret --set secret.azureclientsecret=$clientSecret --set appHostName=$appHostName --set tlsSecretName=$tlsSecretName easyauth-proxy ./easyauth/easyauth-proxy
139126

140127
# ---------------------
141128
# Apply proxy ingress rules

0 commit comments

Comments
 (0)