-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Import-BcConfigurationPackage function #2719
base: master
Are you sure you want to change the base?
Conversation
@sergeyol please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
@microsoft-github-policy-service agree [company="SMART business LLC"] |
@sergeyol the command you issued was incorrect. Please try again. Examples are:
and
|
@microsoft-github-policy-service agree company="SMART business LLC" |
@sergeyol I think there is already a function that imports and applies configuration packages. |
@eclipses how can it be used with online environments? |
@sergeyol that function I pointed out works only for Nav/Bc Containers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please add to releasenotes.txt and add to Bc.SaaSHelper.ps1
|
||
if ($importPackage) { | ||
Write-Host @newLine "Importing package" | ||
Invoke-RestMethod -Headers $authHeaders -Method Post -Uri "$automationApiUrl/companies($companyId)/configurationPackages($confPackageId)/Microsoft.NAV.import" -ContentType 'application/json' -Verbose:$VerbosePreference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If uploading the configuration package could take more than 60 minutes, then you should renew the authcontext and create a new authHeaders before invoking the next webrequest as the accesstoken has a max. duration of 60 minutes.
|
||
if ($importPackage -and $applyPackage) { | ||
Write-Host @newLine "Applying package" | ||
Invoke-RestMethod -Headers $authHeaders -Method Post -Uri "$automationApiUrl/companies($companyId)/configurationPackages($confPackageId)/Microsoft.NAV.apply" -ContentType 'application/json' -Verbose:$VerbosePreference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Importing the configuration package could take more than 60 minutes, then you should renew the authcontext and create a new authHeaders before invoking the next webrequest as the accesstoken has a max. duration of 60 minutes.
[Parameter(Mandatory=$true)] | ||
$packageFile, | ||
[Parameter(Mandatory=$true)] | ||
$packageCode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The packageCode, is that the same as is called packageId in the similar function on containers?
I think parameters should be called the same in both
[Parameter(Mandatory=$false)] | ||
[string] $companyName, | ||
[Parameter(Mandatory=$true)] | ||
$packageFile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is called configPackage in the corresponding function for containers
It would be OK to add an alias called packageFile (to both functions)
[Parameter(Mandatory=$true)] | ||
$packageCode, | ||
[Parameter(Mandatory=$false)] | ||
$packageName = "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packageName is auto-calculated in the other function using something like this:
if (!$packageIdSpecified) {
$packageInfo = Get-PackageInfoFromRapidStartFile $configPackage
if ($packageInfo) {
$packageId = $packageInfo.Code
}
else {
$packageId = [System.IO.Path]::GetFileNameWithoutExtension($configPackage)
$packageId = $packageId.SubString(0, [System.Math]::Min(20, $packageId.Length))
}
}
and then the packageId is used as both name and code.
Is this wrong?
@@ -0,0 +1,161 @@ | |||
<# | |||
.Synopsis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to the SaaS folder instead of BcSaaS (I might have renamed the folder)
Also please rename to Import-ConfigPackageToBcEnvironment
Sorry for the very long delay before getting to look at this. |
Add function to upload configuration package file, import and apply