Closed jfranch closed 3 years ago
Looking at the help for Set-D365LcsApiConfig
Get-Help Set-D365LcsApiConfig -Full
SYNTAX
Set-D365LcsApiConfig [[-ProjectId] <Int32>] [[-ClientId] <String>] [[-BearerToken] <String>] [[-ActiveTokenExpiresO
n] <Int64>] [[-RefreshToken] <String>] [[-LcsApiUri] <String>] [-Temporary] [<CommonParameters>]
So you need to store the ClientId with Set-D365LcsApiConfig
, if you don't want to avoid having to specify it.
Note that you're calling Get-D365LcsApiToken
with the -ClientId, which explains why it works. But when setting your details with Set-D365LcsApiConfig
, you're not providing the -ClientId for the Set-D365LcsApiConfig
.
#This will set all parameters that you can avoid specifying again.
Set-D365LcsApiConfig -ClientId -LcsApiUri -ProjectId
#This pulls a fresh token, and stores the BearerToken, RefreshToken and the ActiveTokenExpiresOn values
Get-D365LcsApiToken -Username -Password | Set-D365LcsApiConfig
#This will pull a fresh token, and stores the BearerToken, RefreshToken and the ActiveTokenExpiresOn values
Get-D365LcsApiConfig | Invoke-D365LcsApiRefreshToken | Set-D365LcsApiConfig
Thanks @Splaxi , I didn't found this doc.
It might be a bit unclear, if you only look at a single command.
But Get-help will so you everything I have documented.
This wiki page shows you some of the same steps.
https://github.com/d365collaborative/d365fo.tools/wiki/How-To-Download-Latest-Bacpac-From-Lcs
Hi, of course get-help shows a very well structured and plenty documentation. In this case I don't pay attention on optional parameters. The problem is not the documentation.
I'm trying to call function Invoke-D365ApiRefreshToken and getting ClientId missing error:
Previously I asked for a token without issues:
Maybe I'm missing something?