Skip to content

Commit 8d2a1c2

Browse files
committed
ADjusted Readme, Added classes to easyauth ingress
1 parent b8b18fc commit 8d2a1c2

File tree

3 files changed

+31
-44
lines changed

3 files changed

+31
-44
lines changed

deploy/aks/easyauth/easyauth-proxy/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ service:
4747
ingress:
4848
enabled: true
4949
annotations:
50-
kubernetes.io/ingress.class: nginx
50+
kubernetes.io/ingress.class: webapprouting.kubernetes.azure.com
5151
cert-manager.io/cluster-issuer: letsencrypt
5252
nginx.ingress.kubernetes.io/proxy-buffering: "on"
5353
nginx.ingress.kubernetes.io/proxy-buffers: "4"

deploy/aks/scripts/easyauth.ps1

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Using template from: https://github.com/Azure/EasyAuthForK8s/blob/master/docs/deploy-to-existing-cluster.md
22
# Docs ref: https://learn.microsoft.com/en-us/azure/aks/ingress-tls?tabs=azure-cli
33

4-
Write-Host ""
5-
Write-Host "Loading azd .env file from current environment"
6-
Write-Host ""
7-
84
$output = azd env get-values
95

106
foreach ($line in $output) {
@@ -17,9 +13,14 @@ foreach ($line in $output) {
1713
[Environment]::SetEnvironmentVariable($name, $value)
1814
}
1915

20-
Write-Host "Environment variables set."
21-
22-
Write-Host "Enabling EasyAuth for the AKS Cluster"
16+
if($env:AZURE_USE_EASY_AUTH -eq "true"){
17+
Write-Host "Enabling EasyAuth for the AKS Cluster"
18+
Write-Host "If you want to disable EasyAuth, please set the AZURE_USE_EASY_AUTH environment variable to false"
19+
} else {
20+
Write-Host "EasyAuth is not enabled for the AKS Cluster"
21+
Write-Host "If you want to enable EasyAuth, please set the AZURE_USE_EASY_AUTH environment variable to true"
22+
exit 1;
23+
}
2324

2425
$location = $env:AZURE_LOCATION
2526

@@ -43,6 +44,14 @@ $nodeRG = az aks show -n $clusterName -g $clusterRG -o json | ConvertFrom-Json |
4344
Write-Host "AKS Cluster is in resource group: $nodeRG"
4445

4546
$ingressIP=$(kubectl get ingress ingress-api -n azure-open-ai -o jsonpath="{.status.loadBalancer.ingress[0].ip}")
47+
48+
if($ingressIP -eq "" -or $null -eq $ingressIP){
49+
Write-Host "Please retry once Ingress Address is assigned to the AKS Cluster"
50+
#kubectl apply -f ..\..\app\backend\manifests\ingress.yml
51+
exit 1;
52+
}
53+
54+
4655
Write-Host "Found Ingress IP: $ingressIP"
4756

4857
# List public IP resources in the specified resource group and convert JSON output to PowerShell object
@@ -61,8 +70,8 @@ $ingressHost=$(az network public-ip show -g $nodeRG -n $ipName -o json | Convert
6170
# This should be the same as the $APP_HOSTNAME
6271
Write-Host "FQDN assigned to the public IP address: $ingressHost"
6372
if ($ingressHost -ne $appHostName) {
64-
Write-Host "FQDN assigned to the public IP address does not match the expected value: $appHostName"
65-
exit 1
73+
Write-Host "FQDN assigned to the public IP address does not match the expected value: $appHostName"
74+
exit 1
6675
}
6776

6877
# ---------------------
@@ -80,11 +89,10 @@ $objectId = $appInfo | Select-Object -ExpandProperty id
8089
Write-Host "Retrieved object ID: $objectId"
8190

8291
# Update the application to disable the first OAuth2Permission
83-
Write-Host "Disabling the first OAuth2Permission"
84-
az ad app update --id $appId --set oauth2Permissions[0].isEnabled=false
85-
92+
#Write-Host "Disabling the first OAuth2Permission"
93+
#az ad app update --id $appId --set oauth2Permissions[0].isEnabled=false
8694
# Clear the OAuth2Permissions array
87-
az ad app update --id $appId --set oauth2Permissions=[]
95+
#az ad app update --id $appId --set oauth2Permissions=[]
8896

8997
# Reset credentials for the Azure AD application to generate a new password
9098
Write-Host "Resetting credentials for the Azure AD application"
@@ -112,11 +120,11 @@ kubectl label namespace cert-manager cert-manager.io/disable-validation=true
112120

113121
# Install the cert manager
114122
helm install cert-manager jetstack/cert-manager `
115-
--namespace cert-manager `
116-
--version v1.14.2 `
117-
--set installCRDs=true `
118-
--set ingressShim.defaultIssuerName=letsencrypt `
119-
--set ingressShim.defaultIssuerKind=ClusterIssuer
123+
--namespace cert-manager `
124+
--version v1.14.2 `
125+
--set installCRDs=true `
126+
--set ingressShim.defaultIssuerName=letsencrypt `
127+
--set ingressShim.defaultIssuerKind=ClusterIssuer
120128

121129
kubectl get pods -n cert-manager
122130

@@ -200,4 +208,4 @@ Configuration AKS details:
200208
- Public AKS Resource Group: $nodeRG
201209
"@
202210

203-
Write-Host $easyAuthConfig
211+
Write-Host $easyAuthConfig

docs/aks/README-AKS.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -193,28 +193,8 @@ azd env set AZURE_SEARCH_SERVICE_LOCATION "eastus2" # Region of the ACS service
193193
azd up
194194
```
195195

196-
### Running locally
197-
198-
1. Run
199-
200-
```shell
201-
az login
202-
```
203-
204-
2. Change dir to `app`
205-
206-
```shell
207-
cd app
208-
```
209-
210-
3. Run the `./start.ps1` (Windows) or `./start.sh` (Linux/Mac) scripts or run the "VS Code Task: Start App" to start the project locally.
211-
4. Wait for the docker compose to start all the containers (web, api, indexer) and refresh your browser to [http://localhost](http://localhost)
212-
213196
### UI Navigation
214197

215-
- In Azure: navigate to the Web App deployed by azd. The URL is printed out when azd completes (as "Endpoint"), or you can find it in the Azure portal.
216-
- Running locally: navigate to localhost:8080
217-
218198
Once in the web app:
219199

220200
- Try different topics in chat or Q&A context. For chat, try follow-up questions, clarifications, ask to simplify or elaborate on answer, etc.
@@ -236,11 +216,11 @@ If you want to chat with your custom documents you can:
236216

237217
### Enabling Application Insights
238218

239-
Applications Insights is enabled by default. It allows to investigate each request tracing along with the logging of errors.
219+
Applications Insights is disabled by default. It allows to investigate each request tracing along with the logging of errors.
240220

241221
If you want to disable it set the `AZURE_USE_APPLICATION_INSIGHTS` variable to false before running `azd up`
242222

243-
1. Run `azd env set AZURE_USE_APPLICATION_INSIGHTS false`
223+
1. Run `azd env set AZURE_USE_APPLICATION_INSIGHTS true`
244224
1. Run `azd up`
245225

246226
To see the performance data, go to the Application Insights resource in your resource group, click on the "Investigate -> Performance" blade and navigate to any HTTP request to see the timing data.
@@ -257,8 +237,7 @@ To see any exceptions and server errors, navigate to the "Investigate -> Failure
257237
azd env set AZURE_USE_EASY_AUTH true
258238
```
259239

260-
By default, the deployed apps on AKS will have no authentication or access restrictions enabled, meaning anyone with routable network access to the web app can chat with your indexed data.You can require authentication to your Microsoft Entra by following the [Add app authentication](https://learn.microsoft.com/en-us/azure/container-apps/authentication) tutorial and set it up against the deployed web and api apps.
261-
Furthermore in order to let Web app to access the Api app be sure to configure native client access with [user_impersonation ](https://learn.microsoft.com/en-us/azure/container-apps/authentication-azure-active-directory#native-client-application)
240+
By default, the deployed apps on AKS will have no authentication or access restrictions enabled, meaning anyone with routable network access to the web app can chat with your indexed data. If you enable easy authentication the deployment will use a script based on [EasyAuthForK8s](https://github.com/Azure/EasyAuthForK8s) and using [Cert Manager](https://cert-manager.io/) to manage easy authentication for you using Microsoft Entra.
262241

263242
To then limit access to a specific set of users or groups, you can follow the steps from [Restrict your Microsoft Entra app to a set of users](https://learn.microsoft.com/entra/identity-platform/howto-restrict-your-app-to-a-set-of-users) by changing "Assignment Required?" option under the Enterprise Application, and then assigning users/groups access. Users not granted explicit access will receive the error message -AADSTS50105: Your administrator has configured the application <app_name> to block users
264243

0 commit comments

Comments
 (0)