Skip to content

Commit 009229e

Browse files
committed
step-wise behavioral change
1 parent a895aec commit 009229e

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

articles/app-service/app-service-key-vault-references.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Alternatively:
8585
8686
## Rotation
8787
88-
If a version is not specified in the reference, then the app will use the latest version that exists in Key Vault. When newer versions become available, such as with a rotation event, the app will automatically update and begin using the latest version within one day. Any configuration changes made to the app will cause an immediate update to the latest versions of all referenced secrets.
88+
If a version is not specified in the reference, then the app will use the latest version that exists in the key vault. When newer versions become available, such as with a rotation event, the app will automatically update and begin using the latest version within 24 hours. The delay is because App Service caches the values of the key vault references and re-fetches it every 24 hours. Any configuration changes to the app causes an immediate re-fetch of all referenced secrets.
8989
9090
## Source Application Settings from Key Vault
9191

articles/app-service/tutorial-networking-isolate-vnet.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ What you will learn:
3232

3333
The tutorial assumes that you have followed the [Tutorial: Secure Cognitive Service connection from App Service using Key Vault](tutorial-connect-msi-keyvault.md) and created the language detector app.
3434

35-
The tutorial continues to use the following environment variables. Make sure you set them properly.
35+
The tutorial continues to use the following environment variables from the previous tutorial. Make sure you set them properly.
3636

3737
```azurecli-interactive
3838
groupName=myKVResourceGroup
3939
region=westeurope
4040
csResourceName=<cs-resource-name>
4141
appName=<app-name>
4242
vaultName=<vault-name>
43-
vaultResourceId=...
4443
```
4544

4645
## Create VNet and subnets
@@ -95,46 +94,51 @@ Because your Key Vault and Cognitive Services resources will sit behind [private
9594
1. In the private endpoint subnet of your VNet, create a private endpoint for your key vault.
9695
9796
```azurecli-interactive
98-
az network private-endpoint create --resource-group $groupName --name securekeyvault-pe --location $region --connection-name securekeyvault-pc --private-connection-resource-id $vaultResourceId --group-id vault --vnet-name $vnetName --subnet private-endpoint-subnet
99-
```
97+
# Save Cognitive Services resource ID in a variable for convenience
98+
csResourceId=$(az cognitiveservices account show --resource-group $groupName --name $csResourceName --query id --output tsv)
10099
101-
> [!TIP]
102-
> The `$vaultResourceId` variable is set in the [prerequisite](#prerequisites) tutorial (in [Secure back-end connectivity](tutorial-connect-msi-keyvault.md#secure-back-end-connectivity)).
100+
az network private-endpoint create --resource-group $groupName --name securecstext-pe --location $region --connection-name securecstext-pc --private-connection-resource-id $csResourceId --group-id account --vnet-name $vnetName --subnet private-endpoint-subnet
101+
```
103102
104-
1. Create a DNS zone group for the key vault private endpoint. DNS zone group is a link between the private DNS zone and the private endpoint. This link helps you to auto update the private DNS Zone when there is an update to the private endpoint.
103+
1. Create a DNS zone group for the Cognitive Services private endpoint. DNS zone group is a link between the private DNS zone and the private endpoint. This link helps you to auto update the private DNS Zone when there is an update to the private endpoint.
105104
106105
```azurecli-interactive
107-
az network private-endpoint dns-zone-group create --resource-group $groupName --endpoint-name securekeyvault-pe --name securekeyvault-zg --private-dns-zone privatelink.vaultcore.azure.net --zone-name privatelink.vaultcore.azure.net
106+
az network private-endpoint dns-zone-group create --resource-group $groupName --endpoint-name securecstext-pe --name securecstext-zg --private-dns-zone privatelink.cognitiveservices.azure.com --zone-name privatelink.cognitiveservices.azure.com
108107
```
109108
110-
1. Block public traffic to the key vault endpoint.
109+
1. Block public traffic to the Cognitive Services resource.
111110
112111
```azurecli-interactive
113-
az keyvault update --name $vaultName --default-action Deny
112+
az rest --uri $csResourceId?api-version=2017-04-18 --method PATCH --body '{"properties":{"publicNetworkAccess":"Disabled"}}' --headers 'Content-Type=application/json'
114113
```
115114
116-
1. Repeat the steps above for the Cognitive Services resource.
115+
> [!NOTE]
116+
> Within a few minutes of you blocking public traffic, you can observe the behavior change in the sample app. You can still load the app, but if you try click the **Detect** button, you get an `HTTP 500` error. The app has lost its connectivity to the Cognitive Services resource through the shared networking.
117117
118-
```azurecli-interactive
119-
# Save Cognitive Services resource ID in a variable for convenience
120-
csResourceId=$(az cognitiveservices account show --resource-group $groupName --name $csResourceName --query id --output tsv)
118+
1. Repeat the steps above for the key vault.
121119
122-
# Create private endpoint for Cognitive Services resource
123-
az network private-endpoint create --resource-group $groupName --name securecstext-pe --location $region --connection-name securecstext-pc --private-connection-resource-id $csResourceId --group-id account --vnet-name $vnetName --subnet private-endpoint-subnet
120+
```azurecli-interactive
121+
# Create private endpoint for key vault
122+
vaultResourceId=$(az keyvault show --name $vaultName --query id --output tsv)
123+
az network private-endpoint create --resource-group $groupName --name securekeyvault-pe --location $region --connection-name securekeyvault-pc --private-connection-resource-id $vaultResourceId --group-id vault --vnet-name $vnetName --subnet private-endpoint-subnet
124124
# Create DNS zone group for the endpoint
125-
az network private-endpoint dns-zone-group create --resource-group $groupName --endpoint-name securecstext-pe --name securecstext-zg --private-dns-zone privatelink.cognitiveservices.azure.com --zone-name privatelink.cognitiveservices.azure.com
126-
# Block public traffic to the endpoint
127-
az rest --uri $csResourceId?api-version=2017-04-18 --method PATCH --body '{"properties":{"publicNetworkAccess":"Disabled"}}' --headers 'Content-Type=application/json'
125+
az network private-endpoint dns-zone-group create --resource-group $groupName --endpoint-name securekeyvault-pe --name securekeyvault-zg --private-dns-zone privatelink.vaultcore.azure.net --zone-name privatelink.vaultcore.azure.net
126+
# Block public traffic to key vault
127+
az keyvault update --name $vaultName --default-action Deny
128128
```
129129
130-
> [!TIP]
131-
> `$csResourceName` is set in the [prerequisite](#prerequisites) tutorial (in [Create app with connectivity to Cognitive Services](tutorial-connect-msi-keyvault.md#create-app-with-connectivity-to-Cognitive-Services)).
130+
1. Force an immediate re-fetch of the [key vault references](app-service-key-vault-references.md) in your app by resetting the app settings (for more information, see [Rotation](app-service-key-vault-references.md#rotation)).
131+
132+
```azurecli-interactive
133+
az webapp config appsettings set --resource-group $groupName --name $appName --settings CS_ACCOUNT_NAME="@Microsoft.KeyVault(SecretUri=$csResourceKVUri)" CS_ACCOUNT_KEY="@Microsoft.KeyVault(SecretUri=$csKeyKVUri)"
134+
```
132135
133-
It may take some time for the setting to take effect, but all traffic to the key vault and the Cognitive Services resource are now blocked. If you try out the language detection page now, you'll get an HTTP 500 error.
136+
<!-- If above is not run then it takes a whole day for references to update? https://docs.microsoft.com/en-us/azure/app-service/app-service-key-vault-references#rotation -->
134137
135-
<!-- TODO - This seems to take a long time to take effect. -->
138+
> [!NOTE]
139+
> Again, you can observe the behavior change in the sample app. You can no longer load the app because it can no longer access the key vault references. The app has lost its connectivity to the key vault through the shared networking.
136140
137-
These two endpoints are only accessible to clients inside the VNet you created. You can't even access the secrets in the key vault through **Secrets** page in the Azure portal, because the portal accesses them through the public internet (see [Manage the locked down resources](#manage-the-locked-down-resources)).
141+
The two private endpoints are only accessible to clients inside the VNet you created. You can't even access the secrets in the key vault through **Secrets** page in the Azure portal, because the portal accesses them through the public internet (see [Manage the locked down resources](#manage-the-locked-down-resources)).
138142
139143
## Configure VNet integration in your app
140144
@@ -156,7 +160,7 @@ These two endpoints are only accessible to clients inside the VNet you created.
156160
az webapp vnet-integration add --resource-group $groupName --name $appName --vnet $vnetName --subnet vnet-integration-subnet
157161
```
158162
159-
VNet integration allows outbound traffic to flow directly into the VNet. By default, only local IP traffic defined in [RFC-1918](https://tools.ietf.org/html/rfc1918#section-3) is routed to the VNet, which is what you need for the private endpoints. To route all your traffic to the VNet, set the [`WEBSITE_VNET_ROUTE_ALL` app setting](reference-app-settings.md#networking). Routing all traffic can also be used if you want to route internet traffic through your VNet e.g. through an [Azure VNet NAT](../virtual-network/nat-gateway/nat-overview.md) or an [Azure Firewall](../firewall/overview.md).
163+
VNet integration allows outbound traffic to flow directly into the VNet. By default, only local IP traffic defined in [RFC-1918](https://tools.ietf.org/html/rfc1918#section-3) is routed to the VNet, which is what you need for the private endpoints. To route all your traffic to the VNet, see [Manage virtual network integration routing](configure-vnet-integration-routing.md). Routing all traffic can also be used if you want to route internet traffic through your VNet e.g. through an [Azure VNet NAT](../virtual-network/nat-gateway/nat-overview.md) or an [Azure Firewall](../firewall/overview.md).
160164
161165
1. In the browser, navigate to `<app-name>.azurewebsites.net` again and wait for the integration to take effect. If you get detection results back, then you're connecting to the Cognitive Services endpoint with key vault references. If you get an HTTP 500 error, wait a few minutes and try again.
162166

0 commit comments

Comments
 (0)