-
Notifications
You must be signed in to change notification settings - Fork 25
/
04-preview-providers.sh
executable file
·36 lines (28 loc) · 2.11 KB
/
04-preview-providers.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Important: Enabling preview features of AKS takes effect at the subscription level. I advise that you enable these only on non-production subscription as
# it may alter the default behavior of some of the CLI commands and/or services in scope
echo "No configured preview features currently enabled!"
echo "Please uncomment the required features as needed."
# Enable aks preview features (like autoscaler) through aks-preview Azure CLI extension
# az extension add --name aks-preview
# If you already enabled the aks-preview extension before, make sure you are using the latest version
# If the version is not per the required features, execute update instead of add
# At the time of writing this, version was 0.4.17
# az extension update --name aks-preview
# Enabling Azure Policy for AKS
# Docs: https://docs.microsoft.com/en-us/azure/governance/policy/concepts/rego-for-aks
# Register the Azure Policy provider
# az provider register --namespace Microsoft.PolicyInsights
# Enables installing the add-on
# az feature register --namespace Microsoft.ContainerService --name AKS-AzurePolicyAutoApprove
# Enables the add-on to call the Azure Policy resource provider
# az feature register --namespace Microsoft.PolicyInsights --name AKS-DataplaneAutoApprove
# Once the above shows 'Registered' run the following to propagate the update
# az provider register -n Microsoft.PolicyInsights
# As the new resource provider takes time (several mins) to register, you can check the status here. Wait for the state to show "Registered"
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/WindowsPreview')].{Name:name,State:properties.state}"
az feature list -o table --query "[?contains(name, 'Microsoft.ContainerService/AKS-AzurePolicyAutoApprove')].{Name:name,State:properties.state}"
az feature list -o table --query "[?contains(name, 'Microsoft.PolicyInsights/AKS-DataPlaneAutoApprove')].{Name:name,State:properties.state}"
# After registrations finish with status "Registered", you can update the provider
az provider register --namespace Microsoft.ContainerService
echo "Preview Providers Registration Completed"