Skip to content

Commit 6920cd7

Browse files
authored
Create SubmitTo-MicrosoftStore.ps1
1 parent 37f679b commit 6920cd7

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2024 Files Community
2+
# Licensed under the MIT License. See the LICENSE.
3+
4+
param(
5+
[string]$SubmissionDirPath = "",
6+
[string]$StoreBrokerConfigPath = "",
7+
[string]$AppxPackagePath = "",
8+
[string]$PartnerCenterClientId = "",
9+
[string]$PartnerCenterClientSecret = "",
10+
[string]$PartnerCenterStoreId = "",
11+
[string]$PartnerCenterTenantId = ""
12+
)
13+
14+
# Setup
15+
Set-ExecutionPolicy RemoteSigned -Force
16+
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
17+
Install-Module -Name StoreBroker
18+
19+
# Authenticate StoreBroker
20+
$UserName = $PartnerCenterClientId
21+
$Password = ConvertTo-SecureString $PartnerCenterClientSecret
22+
$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password)
23+
Set-StoreBrokerAuthentication -TenantId $PartnerCenterTenantId -Credential $Credential
24+
25+
# Prepare the submission package
26+
New-SubmissionPackage -ConfigPath $StoreBrokerConfigPath -AppxPath $AppxPackagePath -OutPath $SubmissionDirPath -OutName 'submission'
27+
$SubmissionDataPath = Join-Path -Path $SubmissionDirPath -ChildPath 'submission.json'
28+
$SubmissionPackagePath = Join-Path -Path $SubmissionDirPath -ChildPath 'submission.zip'
29+
30+
# Upload the package
31+
Update-ApplicationSubmission -Verbose -ReplacePackages -AppId $PartnerCenterStoreId -SubmissionDataPath $SubmissionDataPath -PackagePath $SubmissionPackagePath -AutoCommit -Force -NoStatus

0 commit comments

Comments
 (0)