Editar

Compartilhar via


New-AzConnectedKubernetes

API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM).

Syntax

New-AzConnectedKubernetes
   -ClusterName <String>
   -ResourceGroupName <String>
   [-SubscriptionId <String>]
   [-HttpProxy <Uri>]
   [-HttpsProxy <Uri>]
   [-NoProxy <String>]
   [-ProxyCert <String>]
   [-OnboardingTimeout <Int32>]
   [-DisableAutoUpgrade]
   [-ContainerLogPath <String>]
   -Location <String>
   [-KubeConfig <String>]
   [-KubeContext <String>]
   [-AzureHybridBenefit <AzureHybridBenefit>]
   [-Distribution <String>]
   [-DistributionVersion <String>]
   [-Infrastructure <String>]
   [-PrivateLinkScopeResourceId <String>]
   [-PrivateLinkState <PrivateLinkState>]
   [-ProvisioningState <ProvisioningState>]
   [-Tag <Hashtable>]
   [-CustomLocationsOid <String>]
   [-OidcIssuerProfileEnabled]
   [-OidcIssuerProfileSelfHostedIssuerUrl <String>]
   [-WorkloadIdentityEnabled]
   [-AcceptEULA]
   [-DefaultProfile <PSObject>]
   [-AsJob]
   [-NoWait]
   [-ConfigurationSetting <Hashtable>]
   [-ConfigurationProtectedSetting <Hashtable>]
   [-GatewayResourceId <String>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

API to register a new Kubernetes cluster and create a tracked resource in Azure Resource Manager (ARM).

Examples

Example 1: Create a connected kubernetes.

New-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus

Location Name              ResourceGroupName
-------- ----              -----------------
eastus   azps_test_cluster azps_test_group

This command creates a connected kubernetes.

Example 2: Create a connected kubernetes with parameters kubeConfig and kubeContext.

New-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01

Location Name              ResourceGroupName
-------- ----              -----------------
eastus   azps_test_cluster azps_test_group

This command creates a connected kubernetes with parameters kubeConfig and kubeContext.

Example 3: Create a ConnectedKubernetes's AzureHybridBenefit.

New-AzConnectedKubernetes -ClusterName azps_test_cluster_ahb -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01 -PrivateLinkState 'Enabled' -Distribution "AKS_Management" -DistributionVersion "1.0" -PrivateLinkScopeResourceId "/subscriptions/{subscriptionId}/resourceGroups/azps_test_group/providers/Microsoft.HybridCompute/privateLinkScopes/azps-privatelinkscope" -infrastructure "azure_stack_hci" -ProvisioningState 'Succeeded' -AzureHybridBenefit 'True'

I confirm I have an eligible Windows Server license with Azure Hybrid Benefit to apply this benefit to AKS on Azure Stack HCI or Windows Server. Visit https://aka.ms/ahb-aks for details.
[Y] Yes  [N] No  (default is "N"): Y

Location Name                  ResourceGroupName
-------- ----                  -----------------
eastus   azps_test_cluster_ahb azps_test_group

Create a ConnectedKubernetes's AzureHybridBenefit.

New-AzConnectedKubernetes -ClusterName azps_test_cluster_ahb -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01 -PrivateLinkState 'Enabled' -Distribution "AKS_Management" -DistributionVersion "1.0" -PrivateLinkScopeResourceId "/subscriptions/{subscriptionId}/resourceGroups/azps_test_group/providers/Microsoft.HybridCompute/privateLinkScopes/azps-privatelinkscope" -infrastructure "azure_stack_hci" -ProvisioningState 'Succeeded' -AzureHybridBenefit 'True' -AcceptEULA

Location Name                  ResourceGroupName
-------- ----                  -----------------
eastus   azps_test_cluster_ahb azps_test_group

Using [-AcceptEULA] will default to your acceptance of the terms of our legal agreement and create a connected kubernetes.

Example 5: Create a connected kubernetes with parameters HttpProxy, HttpsProxy, NoProxy and Proxy.

New-AzConnectedKubernetes -ClusterName azps_test_cluster_ahb -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01 -HttpProxy "http://proxy-user:proxy-password@proxy-ip:port" -HttpsProxy "http://proxy-user:proxy-password@proxy-ip:port" -NoProxy "localhost,127.0.0.0/8,192.168.0.0/16,172.17.0.0/16,10.96.0.0/12,10.244.0.0/16,10.43.0.0/24,.svc" -Proxy "http://proxy-user:proxy-password@proxy-ip:port"

Location Name                  ResourceGroupName
-------- ----                  -----------------
eastus   azps_test_cluster_ahb azps_test_group

This command creates a connected kubernetes with parameters HttpProxy, HttpsProxy, NoProxy and Proxy.

Example 6: Create a connected kubernetes with parameters HttpProxy, HttpsProxy, NoProxy, Proxy and ProxyCredential.

$pwd = ConvertTo-SecureString -String "****" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ("proxy-user", $pwd)
New-AzConnectedKubernetes -ClusterName azps_test_cluster_ahb -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01 -HttpProxy "http://proxy-user:proxy-password@proxy-ip:port" -HttpsProxy "http://proxy-user:proxy-password@proxy-ip:port" -NoProxy "localhost,127.0.0.0/8,192.168.0.0/16,172.17.0.0/16,10.96.0.0/12,10.244.0.0/16,10.43.0.0/24,.svc" -Proxy "http://proxy-ip:port" -ProxyCredential $cred

Location Name                  ResourceGroupName
-------- ----                  -----------------
eastus   azps_test_cluster_ahb azps_test_group

This command creates a connected kubernetes with parameters HttpProxy, HttpsProxy, NoProxy, Proxy and ProxyCredential.

Example 7: Create a connected kubernetes and disable auto upgrade of arc agents.

New-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableAutoUpgrade

Location Name              ResourceGroupName
-------- ----              -----------------
eastus   azps_test_cluster azps_test_group

This command creates a connected kubernetes and disable auto upgrade of arc agents.

Example 8: Create a connected kubernetes with custom onboarding timeout.

New-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -OnboardingTimeout 600

Location Name              ResourceGroupName
-------- ----              -----------------
eastus   azps_test_cluster azps_test_group

This command creates a connected kubernetes with custom onboarding timeout.

Parameters

-AcceptEULA

Accept EULA of ConnectedKubernetes, legal term will pop up without this parameter provided

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AsJob

Run the command as a job

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AzureHybridBenefit

Indicates whether Azure Hybrid Benefit is opted in

Type:AzureHybridBenefit
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ClusterName

The name of the Kubernetes cluster on which get is called.

Type:String
Aliases:Name
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ConfigurationProtectedSetting

Arc Agentry System Protected Configuration (hash table of hash tables).

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ConfigurationSetting

Arc Agentry System Configuration (hash table of hash tables).

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContainerLogPath

Override the default container log path to enable fluent-bit logging.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CustomLocationsOid

OID of 'custom-locations' app.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableAutoUpgrade

Flag to disable auto upgrade of arc agents.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Distribution

The Kubernetes distribution running on this connected cluster.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DistributionVersion

The Kubernetes distribution version on this connected cluster.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-GatewayResourceId

Arc Gateway resource Id

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HttpProxy

The http URI of the proxy server for the kubernetes cluster to use

Type:Uri
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HttpsProxy

The https URI of the proxy server for the kubernetes cluster to use

Type:Uri
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Infrastructure

The infrastructure on which the Kubernetes cluster represented by this connected cluster is running on.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-KubeConfig

Path to the kube config file

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-KubeContext

Kubconfig context from current machine

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Location

The geo-location where the resource lives

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-NoProxy

The comma-separated list of hostnames that should be excluded from the proxy server for the kubernetes cluster to use

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-NoWait

Run the command asynchronously

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OidcIssuerProfileEnabled

Whether to enable oidc issuer for workload identity integration.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OidcIssuerProfileSelfHostedIssuerUrl

The issuer url for public cloud clusters - AKS, EKS, GKE - used for the workload identity feature.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OnboardingTimeout

The time required (in seconds) for the arc-agent pods to be installed on the kubernetes cluster.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrivateLinkScopeResourceId

The resource id of the private link scope this connected cluster is assigned to, if any.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PrivateLinkState

Property which describes the state of private link on a connected cluster resource.

Type:PrivateLinkState
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProvisioningState

Provisioning state of the connected cluster resource.

Type:ProvisioningState
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProxyCert

The path to the certificate file for proxy or custom Certificate Authority.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group. The name is case insensitive.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SubscriptionId

The ID of the target subscription.

Type:String
Position:Named
Default value:(Get-AzContext).Subscription.Id
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Resource tags.

Type:Hashtable
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WorkloadIdentityEnabled

Whether to enable or disable the workload identity Webhook

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IConnectedCluster