private ManagedCluster BuildNewCluster() { BeforeBuildNewCluster(); var pubKey = new List <ContainerServiceSshPublicKey> { new ContainerServiceSshPublicKey(SshKeyValue) }; var linuxProfile = new ContainerServiceLinuxProfile(LinuxProfileAdminUserName, new ContainerServiceSshConfiguration(pubKey)); acsServicePrincipal = EnsureServicePrincipal(ServicePrincipalIdAndSecret?.UserName, ServicePrincipalIdAndSecret?.Password?.ConvertToString()); var spProfile = new ManagedClusterServicePrincipalProfile( acsServicePrincipal.SpId, acsServicePrincipal.ClientSecret); var aadProfile = GetAadProfile(); var defaultAgentPoolProfile = GetAgentPoolProfile(); var windowsProfile = GetWindowsProfile(); var networkProfile = GetNetworkProfile(); var apiServerAccessProfile = CreateOrUpdateApiServerAccessProfile(null); var addonProfiles = CreateAddonsProfiles(); WriteVerbose(string.Format(Resources.DeployingYourManagedKubeCluster, AcsSpFilePath)); var managedCluster = new ManagedCluster( Location, name: Name, tags: TagsConversionHelper.CreateTagDictionary(Tag, true), dnsPrefix: DnsNamePrefix, kubernetesVersion: KubernetesVersion, agentPoolProfiles: new List <ManagedClusterAgentPoolProfile> { defaultAgentPoolProfile }, linuxProfile: linuxProfile, windowsProfile: windowsProfile, servicePrincipalProfile: spProfile, aadProfile: aadProfile, addonProfiles: addonProfiles, networkProfile: networkProfile, apiServerAccessProfile: apiServerAccessProfile); if (EnableRbac.IsPresent) { managedCluster.EnableRBAC = EnableRbac; } if (this.IsParameterBound(c => c.FqdnSubdomain)) { managedCluster.FqdnSubdomain = FqdnSubdomain; } //if(EnablePodSecurityPolicy.IsPresent) //{ // managedCluster.EnablePodSecurityPolicy = EnablePodSecurityPolicy; //} return(managedCluster); }