Forum Discussion
MohitMakhija199
2 years agoMicrosoft Employee
Unable 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.
MohitMakhija199
2 years agoMicrosoft Employee
Thanks KevinChant for the answer,
using service principal solution also works as you have shown, in my case also, there was a slight parsing error of the response, but the token works fine.
Developers can use both ways to get the token and automate their deployments.