{"id":2398,"date":"2026-05-18T15:34:52","date_gmt":"2026-05-18T19:34:52","guid":{"rendered":"https:\/\/enterpriseadmins.org\/blog\/?p=2398"},"modified":"2026-05-18T15:34:52","modified_gmt":"2026-05-18T19:34:52","slug":"using-powercli-with-federated-vcf-9-1-authentication","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/using-powercli-with-federated-vcf-9-1-authentication\/","title":{"rendered":"Using PowerCLI with Federated VCF 9.1 Authentication"},"content":{"rendered":"\n<p>The VCF PowerCLI 9.1 release notes call out an interesting change to the <code>Connect-VIServer<\/code> cmdlet (<a href=\"https:\/\/techdocs.broadcom.com\/us\/en\/vmware-cis\/vcf\/vcf-9-0-and-later\/9-1\/release-notes\/vmware-cloud-foundation-9-1-0-0-release-notes\/what-s-new\/whats-new-vcf-cli-api-sdk\/vcf-powercli-changelog\/vmware-vimautomation-core.html\">https:\/\/techdocs.broadcom.com\/us\/en\/vmware-cis\/vcf\/vcf-9-0-and-later\/9-1\/release-notes\/vmware-cloud-foundation-9-1-0-0-release-notes\/what-s-new\/whats-new-vcf-cli-api-sdk\/vcf-powercli-changelog\/vmware-vimautomation-core.html<\/a>)<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>Connect-VIServer<br>&#8211; <\/strong>Added parameter &#8216;VcfApiToken&#8217;<br>&#8211; Added parameter &#8216;VcfOAuthSecurityContext&#8217;<\/p>\n<\/blockquote>\n\n\n\n<p>This change introduces native support for API token authentication in federated VCF environments, making non-interactive automation significantly easier than previous SAML-based approaches.<\/p>\n\n\n\n<p>In a prior post (<a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/how-to-use-powercli-with-federated-vcenter-logins\/\">https:\/\/enterpriseadmins.org\/blog\/scripting\/how-to-use-powercli-with-federated-vcenter-logins\/<\/a>), I wrote about using a <code>-SamlSecurityContext<\/code> parameter to login to a vCenter that had been configured with federated identity.  That approach required additional setup using a non-federated user in PowerCLI and only supported interactive browser-based authentication.<\/p>\n\n\n\n<p>This post will focus on using the latest <code>Connect-VIServer<\/code> cmdlet to connect to a VCF 9.1 vSphere instance. In this environment, an Identity Broker has already been configured using generic OIDC and the VCF Instance is configured to use the SSO provider. Here is a screenshot of the overview page confirming this configuration:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"706\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1024x706.png\" alt=\"\" class=\"wp-image-2399\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1024x706.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-300x207.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-768x529.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image.png 1423w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Creating an API Client and Token<\/h2>\n\n\n\n<p>In the screenshot above, we can see an &#8216;API Access&#8217; tab.  From here we can create API Clients and API Tokens.  We&#8217;ll start by selecting create on the &#8216;API CLIENTS&#8217; sub tab.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"478\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1-1024x478.png\" alt=\"\" class=\"wp-image-2400\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1-1024x478.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1-300x140.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1-768x358.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-1.png 1425w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>For Client Name, I&#8217;ll enter <code>VCF_PowerCLI_Admin<\/code> and then select &#8216;CREATE API CLIENT&#8217;.  In Roles, I&#8217;ll set the scope to be <code>Components with vcf479-vidb-01<\/code> and for role will select <code>VCF Administrator<\/code>.  I&#8217;ll finally select SAVE on this page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"671\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2-1024x671.png\" alt=\"\" class=\"wp-image-2401\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2-1024x671.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2-300x197.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2-768x503.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-2.png 1422w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>With the API Client created, I&#8217;ll select the vertical ellipsis and then &#8216;Generate API Token&#8217;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"508\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3-1024x508.png\" alt=\"\" class=\"wp-image-2402\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3-1024x508.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3-300x149.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3-768x381.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-3.png 1427w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>For the &#8216;API Token Name&#8217; I&#8217;ll provide <code>Brian-PowerCLI-Admin<\/code> and click &#8216;Generate API Token&#8217;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"654\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4-1024x654.png\" alt=\"\" class=\"wp-image-2403\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4-1024x654.png 1024w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4-300x192.png 300w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4-768x491.png 768w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-4.png 1423w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>This will provide a summary of the token generated. I will not be able to continue until I&#8217;ve copied the token value.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"692\" src=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-5.png\" alt=\"\" class=\"wp-image-2404\" srcset=\"https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-5.png 590w, https:\/\/enterpriseadmins.org\/blog\/wp-content\/uploads\/2026\/05\/image-5-256x300.png 256w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Connecting with PowerCLI<\/h2>\n\n\n\n<p>The release notes called out two options for authentication.  Here is where I believe each of these options would be appropriate.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Method<\/strong><\/td><td><strong>Use Case<\/strong><\/td><\/tr><tr><td><code>-VcfApiToken<\/code><\/td><td>Simple direct login to vCenter<\/td><\/tr><tr><td><code>-VcfOAuthSecurityContext<\/code><\/td><td>Reusing authentication across multiple VMware products<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>We will demo both of these options below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">VcfApiToken parameter<\/h2>\n\n\n\n<p>This is a very straightforward option. When you pass the token, VCF PowerCLI automatically discovers the associated VCF SSO instance in the background and completes the login process.  After connecting to vCenter, I&#8217;ll retrieve a list of VMs to confirm that the connection is working.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\&gt; Connect-VIServer vcf479-vc-01.lab.enterpriseadmins.org -VcfApiToken 'vidb_MjkxYzNlZTctOWNhZS00MGZjLWE4ZDg&lt;redacted&gt;'\n\nName                           Port  User\n----                           ----  ----\nvcf479-vc-01.lab.enterprise... 443   CUSTOMER\\73c160a0-adcc-4259...\n\n\nPS C:\\&gt; Get-VM\n\nName                 PowerState Num CPUs MemoryGB\n----                 ---------- -------- --------\nvcf479-license-01    PoweredOn  2        4.000\nvcf479-opscol-01     PoweredOn  4        16.000\nvcf479-ops-01        PoweredOn  4        16.000\nvcf479-nsx-01        PoweredOn  6        24.000\nvcf479-sddcm-01      PoweredOn  4        16.000\nvcf479-vsp-01-c8bmk  PoweredOn  12       24.000\nvcf479-vsp-01-rnn58  PoweredOn  12       24.000\nvcf479-vsp-01-7zdvf  PoweredOn  12       24.000\nvcf479-vsp-01-2dcws  PoweredOn  4        10.000\nvcf479-vc-01         PoweredOn  4        21.000<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">VcfOAuthSecurityContext parameter<\/h2>\n\n\n\n<p>When using the <code>VcfOAuthSecurityContext<\/code> parameter, the <code>IdentityBrokerHostname<\/code> is also required.  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PS C:\\&gt; $vcfOauthSec = New-VcfOAuthSecurityContext -IdentityBrokerHostname 'vcf479-vidb-01.lab.enterpriseadmins.org' -ApiToken 'vidb_MjkxYzNlZTctOWNhZS00MGZjLWE4ZDg&lt;redacted&gt;'\nPS C:\\&gt;\nPS C:\\&gt; Connect-VIServer vcf479-vc-01.lab.enterpriseadmins.org -VcfOAuthSecurityContext $vcfOauthSec\n\nName                           Port  User\n----                           ----  ----\nvcf479-vc-01.lab.enterprise... 443   CUSTOMER\\73c160a0-adcc-4259...\n\n\nPS C:\\&gt; Get-VM\n\nName                 PowerState Num CPUs MemoryGB\n----                 ---------- -------- --------\nvcf479-license-01    PoweredOn  2        4.000\nvcf479-opscol-01     PoweredOn  4        16.000\nvcf479-ops-01        PoweredOn  4        16.000\nvcf479-nsx-01        PoweredOn  6        24.000\nvcf479-sddcm-01      PoweredOn  4        16.000\nvcf479-vsp-01-c8bmk  PoweredOn  12       24.000\nvcf479-vsp-01-rnn58  PoweredOn  12       24.000\nvcf479-vsp-01-7zdvf  PoweredOn  12       24.000\nvcf479-vsp-01-2dcws  PoweredOn  4        10.000\nvcf479-vc-01         PoweredOn  4        21.000<\/code><\/pre>\n\n\n\n<p>We can use this authenticated security context to connect to other products, such as VCF Operations, which do not provide direct <code>VcfApiToken<\/code> properties.  For example, using the <code>$vcfOauthSec<\/code> variable created above, I can also connect to the operations instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-VcfOpsServer vcf479-ops-01.lab.enterpriseadmins.org -VcfOAuthSecurityContext $vcfOauthSec<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>PowerCLI 9.1 significantly simplifies authentication to federated VCF 9.1 environments.<\/p>\n\n\n\n<p>Compared to previous SAML security context workflows, the new API token and OAuth security context capabilities reduce setup complexity while enabling fully non-interactive authentication. This makes PowerCLI automation easier to integrate with scheduled tasks, orchestration platforms, and CI\/CD pipelines.<\/p>\n\n\n\n<p>For simple vCenter connections, <code>-VcfApiToken<\/code> provides the most straightforward experience. For broader multi-product workflows, <code>-VcfOAuthSecurityContext<\/code> enables authentication reuse across the environment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The VCF PowerCLI 9.1 release notes call out an interesting change to the Connect-VIServer cmdlet (https:\/\/techdocs.broadcom.com\/us\/en\/vmware-cis\/vcf\/vcf-9-0-and-later\/9-1\/release-notes\/vmware-cloud-foundation-9-1-0-0-release-notes\/what-s-new\/whats-new-vcf-cli-api-sdk\/vcf-powercli-changelog\/vmware-vimautomation-core.html) Connect-VIServer&#8211; Added parameter &#8216;VcfApiToken&#8217;&#8211; Added parameter &#8216;VcfOAuthSecurityContext&#8217; This change introduces native support for API token authentication in federated VCF environments, making non-interactive automation significantly &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/using-powercli-with-federated-vcf-9-1-authentication\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9,3,4],"tags":[],"class_list":["post-2398","post","type-post","status-publish","format-standard","hentry","category-lab-infrastructure","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2398","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=2398"}],"version-history":[{"count":6,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2398\/revisions"}],"predecessor-version":[{"id":2410,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/2398\/revisions\/2410"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=2398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=2398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=2398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}