<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error Authenticating as Service Principal using PowerShell Script in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-Authenticating-as-Service-Principal-using-PowerShell/m-p/3030496#M40799</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/315872"&gt;@nbs33&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To learn how to create a service principal for use with Azure PowerShell, see&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/create-azure-service-principal-azureps?view=azps-9.3.0" data-linktype="relative-path" target="_blank"&gt;Create an Azure service principal with Azure PowerShell&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To sign in with a service principal, use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;ServicePrincipal&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameter of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Connect-AzAccount&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;cmdlet. You'll also need the service principal's application ID, sign-in credentials, and the tenant ID associate with the service principal. How you sign in with a service principal depends on whether it's configured for password-based or certificate-based authentication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.3.0#password-based-authentication" target="_self"&gt;Password-based authentication&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.3.0#certificate-based-authentication" target="_self"&gt;Certificate-based authentication&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 07:23:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-01-19T07:23:58Z</dc:date>
    <item>
      <title>Error Authenticating as Service Principal using PowerShell Script</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Authenticating-as-Service-Principal-using-PowerShell/m-p/3029402#M40787</link>
      <description>&lt;P&gt;I am trying to write some scripts to manage out PBI for an embed project. I am using the PS script below that I found online.&amp;nbsp; I am going this "Cannot bind argument to parameter 'Credential' because it is null" error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I verified the Secret, Tenat ID and App ID are correct. I'm stumpped because there is clearly a value for the Client Secret so I am not sure why it is 'null'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to PS so I'm hoping there is an obvious error. Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Connect-PowerBIServiceAccount : Cannot bind argument to parameter 'Credential' because it is null.
At C:\Users\micha\OneDrive\Documents\_NBS_Solutions\_Customers\AgencyKPI\Powershell\Test Scripts\Report Distrobution Script.ps1:16 char:81
+ ...  -ServicePrincipal -TenantId $TenantId -Credential $PbiCredentialName
+                                                        ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Connect-PowerBIServiceAccount], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Variables 
$AppId = "*************"
$TenantId = "*************"
$ClientSecret = "*************"

#Create secure string &amp;amp; credential for application id and client secret
$PbiSecurePassword = ConvertTo-SecureString $ClientSecret -Force  -AsPlainText 
$PbiCredential = New-Object Management.Automation.PSCredential($AppId, $PbiSecurePassword)


#Connect to the Power BI service
Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId -Credential $PbiCredentialName&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 18:20:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Authenticating-as-Service-Principal-using-PowerShell/m-p/3029402#M40787</guid>
      <dc:creator>nbs33</dc:creator>
      <dc:date>2023-01-18T18:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error Authenticating as Service Principal using PowerShell Script</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Authenticating-as-Service-Principal-using-PowerShell/m-p/3030496#M40799</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/315872"&gt;@nbs33&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To learn how to create a service principal for use with Azure PowerShell, see&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/create-azure-service-principal-azureps?view=azps-9.3.0" data-linktype="relative-path" target="_blank"&gt;Create an Azure service principal with Azure PowerShell&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To sign in with a service principal, use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;ServicePrincipal&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameter of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Connect-AzAccount&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;cmdlet. You'll also need the service principal's application ID, sign-in credentials, and the tenant ID associate with the service principal. How you sign in with a service principal depends on whether it's configured for password-based or certificate-based authentication.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.3.0#password-based-authentication" target="_self"&gt;Password-based authentication&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-9.3.0#certificate-based-authentication" target="_self"&gt;Certificate-based authentication&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 07:23:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Authenticating-as-Service-Principal-using-PowerShell/m-p/3030496#M40799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T07:23:58Z</dc:date>
    </item>
  </channel>
</rss>

