You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Register the `EventgridPreview` feature flag by using the [Register-AzProviderPreviewFeature][register-azproviderpreviewfeature] cmdlet, as shown in the following example:
It takes a few minutes for the status to show *Registered*. Verify the registration status by using the [Get-AzProviderPreviewFeature][get-azproviderpreviewfeature] cmdlet:
When ready, refresh the registration of the *Microsoft.ContainerService* resource provider by using the [Register-AzResourceProvider][register-azresourceprovider] command:
Create an AKS cluster using the [az aks create][az-aks-create] command. The following example creates a resource group *MyResourceGroup* and a cluster named *MyAKS* with one node in the *MyResourceGroup* resource group:
51
80
52
-
```azurecli
81
+
```azurecli-interactive
53
82
az group create --name MyResourceGroup --location eastus
54
83
az aks create -g MyResourceGroup -n MyAKS --location eastus --node-count 1 --generate-ssh-keys
55
84
```
56
85
86
+
### [Azure PowerShell](#tab/azure-powershell)
87
+
88
+
Create an AKS cluster using the [New-AzAksCluster][new-azakscluster] command. The following example creates a resource group *MyResourceGroup* and a cluster named *MyAKS* with one node in the *MyResourceGroup* resource group:
Create a namespace and event hub using [az eventhubs namespace create][az-eventhubs-namespace-create] and [az eventhubs eventhub create][az-eventhubs-eventhub-create]. The following example creates a namespace *MyNamespace* and an event hub *MyEventGridHub* in *MyNamespace*, both in the *MyResourceGroup* resource group.
60
102
61
-
```azurecli
103
+
```azurecli-interactive
62
104
az eventhubs namespace create --location eastus --name MyNamespace -g MyResourceGroup
63
105
az eventhubs eventhub create --name MyEventGridHub --namespace-name MyNamespace -g MyResourceGroup
Verify your subscription to AKS events using `az eventgrid event-subscription list`:
81
123
82
-
```azurecli
124
+
```azurecli-interactive
83
125
az eventgrid event-subscription list --source-resource-id $SOURCE_RESOURCE_ID
84
126
```
85
127
@@ -124,16 +166,81 @@ The following example output shows you're subscribed to events from the *MyAKS*
124
166
]
125
167
```
126
168
169
+
### [Azure PowerShell](#tab/azure-powershell)
170
+
171
+
Create a namespace and event hub using [New-AzEventHubNamespace][new-azeventhubnamespace] and [New-AzEventHub][new-azeventhub]. The following example creates a namespace *MyNamespace* and an event hub *MyEventGridHub* in *MyNamespace*, both in the *MyResourceGroup* resource group.
The following example output shows you're subscribed to events from the *MyAKS* cluster and those events are delivered to the *MyEventGridHub* event hub:
202
+
203
+
```Output
204
+
EventSubscriptionName : MyEventGridSubscription
205
+
Id : /subscriptions/SUBSCRIPTION_ID/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerService/managedClusters/MyAKS/providers/Microsoft.EventGrid/eventSubscriptions/MyEventGridSubscription
When AKS events occur, you'll see those events appear in your event hub. For example, when the list of available Kubernetes versions for your clusters changes, you'll see a `Microsoft.ContainerService.NewKubernetesVersionAvailable` event. For more information on the events AKS emits, see [Azure Kubernetes Service (AKS) as an Event Grid source][aks-events].
128
223
129
224
## Delete the cluster and subscriptions
130
225
226
+
### [Azure CLI](#tab/azure-cli)
227
+
131
228
Use the [az group delete][az-group-delete] command to remove the resource group, the AKS cluster, namespace, and event hub, and all related resources.
132
229
133
230
```azurecli-interactive
134
231
az group delete --name MyResourceGroup --yes --no-wait
135
232
```
136
233
234
+
### [Azure PowerShell](#tab/azure-powershell)
235
+
236
+
Use the [Remove-AzResourceGroup][remove-azresourcegroup] cmdlet to remove the resource group, the AKS cluster, namespace, and event hub, and all related resources.
237
+
238
+
```azurepowershell-interactive
239
+
Remove-AzResourceGroup -Name MyResourceGroup
240
+
```
241
+
242
+
---
243
+
137
244
> [!NOTE]
138
245
> When you delete the cluster, the Azure Active Directory service principal used by the AKS cluster is not removed. For steps on how to remove the service principal, see [AKS service principal considerations and deletion][sp-delete].
139
246
>
@@ -148,14 +255,24 @@ To learn more about AKS, and walk through a complete code to deployment example,
0 commit comments