Skip to content

Commit 44bf2f9

Browse files
Merge pull request #265641 from greg-lindsay/appgw-issues
public PR 119031
2 parents 1a619af + a28a3aa commit 44bf2f9

File tree

1 file changed

+73
-13
lines changed

1 file changed

+73
-13
lines changed

articles/application-gateway/ingress-controller-install-existing.md

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: greg-lindsay
66
ms.service: application-gateway
77
ms.custom: devx-track-arm-template, linux-related-content, devx-track-azurecli
88
ms.topic: how-to
9-
ms.date: 02/02/2024
9+
ms.date: 02/07/2024
1010
ms.author: greglin
1111
---
1212

@@ -99,8 +99,10 @@ for the AGIC pod to make HTTP requests to [ARM](../azure-resource-manager/manage
9999

100100
1. For the role assignment, run the following command to identify the `principalId` for the newly created identity:
101101

102-
```azurecli
103-
az identity show -g <resourcegroup> -n <identity-name>
102+
```powershell-interactive
103+
$resourceGroup="resource-group-name"
104+
$identityName="identity-name"
105+
az identity list -g $resourceGroup --query "[?name == '$identityName'].principalId | [0]" -o tsv
104106
```
105107

106108
1. Grant the identity **Contributor** access to your Application Gateway. You need the ID of the Application Gateway, which
@@ -112,21 +114,32 @@ looks like: `/subscriptions/A/resourceGroups/B/providers/Microsoft.Network/appli
112114

113115
To assign the identity **Contributor** access, run the following command:
114116

115-
```azurecli
116-
az role assignment create \
117-
--role Contributor \
118-
--assignee <principalId> \
119-
--scope <App-Gateway-ID>
117+
```powershell-interactive
118+
$resourceGroup="resource-group-name"
119+
$identityName="identity-Name"
120+
# Get the Application Gateway ID
121+
$AppGatewayID=$(az network application-gateway list --query '[].id' -o tsv)
122+
$role="contributor"
123+
# Get the principal ID for the User assigned identity
124+
$principalId=$(az identity list -g $resourceGroup --query "[?name == '$identityName'].principalId | [0]" -o tsv)
125+
az role assignment create --assignee $principalId --role $role --scope $AppGatewayID
120126
```
121127

122128
1. Grant the identity **Reader** access to the Application Gateway resource group. The resource group ID looks like:
123129
`/subscriptions/A/resourceGroups/B`. You can get all resource groups with: `az group list --query '[].id'`
124130

125-
```azurecli
126-
az role assignment create \
127-
--role Reader \
128-
--assignee <principalId> \
129-
--scope <App-Gateway-Resource-Group-ID>
131+
```powershell-interactive
132+
$resourceGroup="resource-group-name"
133+
$identityName="identity-Name"
134+
# Get the Application Gateway resource group
135+
$AppGatewayResourceGroup=$(az network application-gateway list --query '[].resourceGroup' -o tsv)
136+
# Get the Application Gateway resource group ID
137+
$AppGatewayResourceGroupID=$(az group show --name $AppGatewayResourceGroup --query id -o tsv)
138+
$role="Reader"
139+
# Get the principal ID for the User assigned identity
140+
$principalId=$(az identity list -g $resourceGroup --query "[?name == '$identityName'].principalId | [0]" -o tsv)
141+
# Assign the Reader role to the User assigned identity at the resource group scope
142+
az role assignment create --role $role --assignee $principalId --scope $AppGatewayResourceGroupID
130143
```
131144

132145
>[!NOTE]
@@ -152,6 +165,53 @@ next section.
152165
secretJSON: <Base64-Encoded-Credentials>
153166
```
154167
168+
## Deploy the Azure Application Gateway Ingress Controller Add-on
169+
### Create an Ingress Controller deployment manifest
170+
```yaml
171+
---
172+
# file: pet-supplies-ingress.yaml
173+
apiVersion: networking.k8s.io/v1
174+
kind: Ingress
175+
metadata:
176+
name: pet-supplies-ingress
177+
annotations:
178+
kubernetes.io/ingress.class: azure/application-gateway
179+
180+
spec:
181+
rules:
182+
- http:
183+
paths:
184+
- path: /
185+
pathType: Prefix
186+
backend:
187+
service:
188+
name: store-front
189+
port:
190+
number: 80
191+
- path: /order-service
192+
pathType: Prefix
193+
backend:
194+
service:
195+
name: order-service
196+
port:
197+
number: 3000
198+
- path: /product-service
199+
pathType: Prefix
200+
backend:
201+
service:
202+
name: product-service
203+
port:
204+
number: 3002
205+
206+
```
207+
### Deploy Ingress Controller
208+
209+
```powershell-interactive
210+
$namespace="namespace"
211+
$file="pet-supplies-ingress.yaml"
212+
kubectl apply -f $file -n $namespace
213+
```
214+
155215
## Install Ingress Controller as a Helm Chart
156216
157217
In the first few steps, we install Helm's Tiller on your Kubernetes cluster. Use [Cloud Shell](https://shell.azure.com/) to install the AGIC Helm package:

0 commit comments

Comments
 (0)