Forum Discussion
MohitMakhija199
Microsoft Employee
2 years agoUnable to get Token for deployment using powershell.
I am trying to deploy notebooks, lakehouses and powerbi reports using the fabric rest api : Items - Create Notebook - REST API (Notebook) | Microsoft Learn I saw some samples in the github repositor...
- 2 years ago
I took a slightly different stance on this, which might be able to help you out.
For one pipeline I commented out the connect-azaccount in the PowerShell script and connected to it outside of the script instead using a service principal account as below:
$SecureStringPwd = ConvertTo-SecureString $(servicePrincipalKey) -AsPlainText -Force$pscredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $(servicePrincipalId), $SecureStringPwdConnect-AzAccount -ServicePrincipal -Credential $pscredential -Tenant $(tenantId)I then ran the script with the commented out line afterwards.Let me know if that helps.
KevinChant
Super User
2 years agoI took a slightly different stance on this, which might be able to help you out.
For one pipeline I commented out the connect-azaccount in the PowerShell script and connected to it outside of the script instead using a service principal account as below:
$SecureStringPwd = ConvertTo-SecureString $(servicePrincipalKey) -AsPlainText -Force
$pscredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $(servicePrincipalId), $SecureStringPwd
Connect-AzAccount -ServicePrincipal -Credential $pscredential -Tenant $(tenantId)
I then ran the script with the commented out line afterwards.
Let me know if that helps.