@@ -24,7 +24,7 @@ To use the Marketplace Toolkit for Microsoft Azure Stack script you require:
2424
2525- This script
2626- The gallerypackager executable (http://www.aka.ms/azurestackmarketplaceitem)
27- - Access as Azure Atack administrator to the Azure Stack environment. This is only required if you want to publish the generated package to the marketplace. For this you will also need to install the current PowerShell modules to support Azure Stack on the machine that runs this script (https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-install).
27+ - Access as Azure Stack administrator to the Azure Stack environment. This is only required if you want to publish the generated package to the marketplace. For this you will also need to install the current PowerShell modules to support Azure Stack on the machine that runs this script (https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-install).
2828
2929The Marketplace Toolkit script for Microsoft Azure Stack is based on PowerShell and the Windows Presentation Foundation. It is published in this public repository so you can make improvements to it by submitting a pull request.
3030
@@ -572,43 +572,30 @@ $XAML = @'
572572 <Button Width="15" Content="!" Foreground="White" Background="Red" BorderThickness="1" BorderBrush="Red" Visibility="Collapsed" Cursor="Hand" />
573573 <Button x:Name="Publish_Btn_Package" Content="Browse" Width="60" Height="23" Margin="8,0,0,0" />
574574 </StackPanel>
575-
576575 <StackPanel Orientation="Horizontal" Width="258" Height="25" >
577576 <Label Content="*" Foreground="red"/>
578- <Label Content="Service admin name" />
579- </StackPanel>
580- <StackPanel Orientation="Horizontal" Width="258" Height="23" Margin="0,0,0,8" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="2147483647" >
581- <TextBox x:Name="Publish_Tbx_Username" Width="258" />
582- <Button Width="15" Content="!" Foreground="White" Background="Red" BorderThickness="1" BorderBrush="Red" Visibility="Collapsed" Cursor="Hand" />
583- </StackPanel>
584-
585- <StackPanel Orientation="Horizontal" Width="258" Height="25" >
586- <Label Content="*" Foreground="red"/>
587- <Label Content="Password" />
577+ <Label Content="API endpoint" />
588578 </StackPanel>
589579 <StackPanel Orientation="Horizontal" Width="258" Height="23" Margin="0,0,0,8" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="2147483647" >
590- <PasswordBox x:Name="Publish_Pwb_Password1 " Width="258" />
580+ <TextBox x:Name="Publish_Tbx_Endpoint " Width="258" />
591581 <Button Width="15" Content="!" Foreground="White" Background="Red" BorderThickness="1" BorderBrush="Red" Visibility="Collapsed" Cursor="Hand" />
592582 </StackPanel>
593-
594583 <StackPanel Orientation="Horizontal" Width="258" Height="25" >
595584 <Label Content="*" Foreground="red"/>
596- <Label Content="Confirm password " />
585+ <Label Content="Azure TenantID " />
597586 </StackPanel>
598587 <StackPanel Orientation="Horizontal" Width="258" Height="23" Margin="0,0,0,8" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="2147483647" >
599- <PasswordBox x:Name="Publish_Pwb_Password2 " Width="258" />
588+ <TextBox x:Name="Publish_Tbx_TenantID " Width="258" />
600589 <Button Width="15" Content="!" Foreground="White" Background="Red" BorderThickness="1" BorderBrush="Red" Visibility="Collapsed" Cursor="Hand" />
601590 </StackPanel>
602-
603591 <StackPanel Orientation="Horizontal" Width="258" Height="25" >
604- <Label Content="*" Foreground="red"/>
605- <Label Content="API endpoint " />
606- </StackPanel>
607- <StackPanel Orientation="Horizontal" Width="258" Height="23" Margin="0,0,0,8" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="2147483647" >
608- <TextBox x:Name="Publish_Tbx_Endpoint " Width="258" />
592+ <Label Content="*" Foreground="red"/>
593+ <Label Content="Region " />
594+ </StackPanel>
595+ <StackPanel Orientation="Horizontal" Width="258" Height="23" Margin="0,0,0,8" ToolTipService.InitialShowDelay="0" ToolTipService.ShowDuration="2147483647" >
596+ <TextBox x:Name="Publish_Tbx_Region " Width="258" />
609597 <Button Width="15" Content="!" Foreground="White" Background="Red" BorderThickness="1" BorderBrush="Red" Visibility="Collapsed" Cursor="Hand" />
610598 </StackPanel>
611-
612599 <Label Content="Publishing log" Margin="0,10,0,10" />
613600 <ListView x:Name="Publish_Lsv_Log" MinHeight="23" Background="#F9F9F9F9"/>
614601 <Border BorderBrush="#CCCCCC" BorderThickness="0,1,0,0" Margin="0,15,0,0">
@@ -657,8 +644,6 @@ $X_Input_Tbx_Icon115.Tag = @{'errormessage'='The image size must be 115x115.'}
657644$X_Input_Tbx_Icon255.Tag = @ {' errormessage' = ' The image size must be 255x115.' }
658645$X_Input_Tbx_Screenshot.Tag = @ {' errormessage' = ' The image size must be 533x324.' }
659646$X_Params_Tbx_AddStep.Tag = @ {' regex' = ' [ a-zA-Z]{1,20}' ;' errormessage' = ' Maximum 20 characters. Can only contain A-Z, a-z and spaces.' }
660- $X_Publish_Pwb_Password1.Tag = @ {' errormessage' = ' Passwords do not match.' }
661- $X_Publish_Pwb_Password1.Tag = @ {' errormessage' = ' Passwords do not match.' }
662647}
663648
664649function F_Clear {
@@ -681,10 +666,8 @@ $X_Params_Tree_View.Tag = $null
681666$X_Params_Tree_View.Items.Clear ()
682667$X_Params_Bdr_Steps.Visibility = ' Collapsed'
683668$X_Publish_Tbx_Package.Text = $null
684- $X_Publish_Tbx_Username.Text = $null
685- $X_Publish_Pwb_Password1.Password = $null
686- $X_Publish_Pwb_Password2.Password = $null
687669$X_Publish_Tbx_Endpoint.Text = $null
670+ $X_Publish_Tbx_TenantID.Text = $null
688671$X_Publish_Lsv_Log.Items.Clear ()
689672$timer.Stop ()
690673}
@@ -715,12 +698,7 @@ if ($regex){
715698 $Script :validation_error = $true
716699 }
717700}
718- if ($compare ){
719- if (($field_value.Length -gt 0 ) -and ($field_value -ne $compare )) {
720- $Script :validation_error = $true
721- $message = " Passwords do not match"
722- }
723- }
701+
724702if ($extension ){
725703 if ($field_value.Length -gt 0 ){
726704 if (test-path $field_value ){
@@ -831,7 +809,6 @@ if ($icon255x115) { $X_Input_Tbx_Icon255.Text = $icon255x115 }
831809if ($screenshot533x324 ) { $X_Input_Tbx_Screenshot.Text = $screenshot533x324 }
832810if ($armTemplate ) { $X_Params_Tbx_Template.Text = $armTemplate }
833811if ($executablePath ) { $X_Params_Tbx_Exe.Text = $executablePath }
834- if ($userName ) { $X_Publish_Tbx_Username.Text = $userName }
835812if ($endpoint ) { $X_Publish_Tbx_Endpoint.Text = $endpoint }
836813$X_Blade_Preview.Visibility = ' Visible'
837814}
@@ -887,10 +864,7 @@ $params | foreach {
887864 $param | Add-Member - Type NoteProperty - Name regex - Value ' ^\d+$'
888865 $param | Add-Member - Type NoteProperty - Name validationMessage - Value ' Only numeric characters are allowed, and it must be a positive value'
889866 }
890- if ($_.value.type -eq ' securestring' ) {
891- $param | Add-Member - Type NoteProperty - Name uiType - Value " Microsoft.Common.PasswordBox"
892- $param | Add-Member - Type NoteProperty - Name constraints - Value $false
893- }
867+
894868
895869 # Add each param to the grid varaiable
896870 $Script :Grid += $param
@@ -1295,17 +1269,7 @@ $script:grid | Sort-Object step, tag | forEach {
12951269 }
12961270
12971271}
1298- if ($_.uiType -eq ' Microsoft.Common.PasswordBox' ){
1299- $uiDef_param = [pscustomobject ]@ {
1300- " name" = $uiDef_param_name
1301- " type" = " Microsoft.Common.PasswordBox"
1302- " label" = [pscustomobject ]@ {
1303- " password" = " Password"
1304- " confirmPassword" = " Confirm password"
1305- }
1306- " toolTip" = $uiDef_param_description
1307- }
1308- }
1272+
13091273
13101274if ($_.step -eq ' elements' ) {
13111275 # element
@@ -1397,22 +1361,20 @@ $X_Params_Tbx_PackagePath.text = $createpackage_azpkg
13971361function F_PublishPackage {
13981362$timer.Start ()
13991363$param_Endpoint = $X_Publish_Tbx_Endpoint.Text
1400- $param_User = $X_Publish_Tbx_Username.Text
1401- $param_Pass = $X_Publish_Pwb_Password1.Password
14021364$param_ResourceGroup = ' system.staging'
1403- $param_ResourceGroupLocation = ' local '
1365+ $param_ResourceGroupLocation = $X_Publish_Tbx_Region .Text
14041366$param_StorageAccountName = ' artifacts'
14051367$param_StorageContainerName = ' marketplace'
14061368$param_Package = $X_Publish_Tbx_Package.Text
1369+ $param_TenantID = $X_Publish_Tbx_TenantID.Text
14071370$job_publish_params = @ (
14081371 $param_Endpoint ,
1409- $param_User ,
1410- $param_Pass ,
14111372 $param_ResourceGroup ,
14121373 $param_ResourceGroupLocation ,
14131374 $param_StorageAccountName ,
14141375 $param_StorageContainerName
14151376 $param_Package
1377+ $param_TenantID
14161378 )
14171379$Script :job = Start-Job - Name " PublishPackage" - ArgumentList $job_publish_params - ScriptBlock $job_publish
14181380}
@@ -1422,13 +1384,12 @@ $Script:job = Start-Job -Name "PublishPackage" -ArgumentList $job_publish_params
14221384$job_publish = {
14231385Param (
14241386[string ]$apiEndpoint = $args [0 ],
1425- [string ]$User = $args [1 ],
1426- [string ]$Pass = $args [2 ],
1427- [string ]$ResourceGroup = $args [3 ],
1428- [string ]$ResourceGroupLocation = $args [4 ],
1429- [string ]$StorageAccountName = $args [5 ],
1430- [string ]$StorageContainerName = $args [6 ],
1431- [string ]$Package = $args [7 ]
1387+ [string ]$ResourceGroup = $args [1 ],
1388+ [string ]$ResourceGroupLocation = $args [2 ],
1389+ [string ]$StorageAccountName = $args [3 ],
1390+ [string ]$StorageContainerName = $args [4 ],
1391+ [string ]$Package = $args [5 ],
1392+ [string ]$TenantID = $args [6 ]
14321393)
14331394
14341395# log
@@ -1446,34 +1407,23 @@ catch {
14461407 Exit
14471408 }
14481409
1449- # log
1450- Write-Output ' Creating Credentials object'
1451- # activity
1452- $SecurePass = ConvertTo-SecureString $Pass - AsPlainText - Force
1453- $AdminCreds = New-Object System.Management.Automation.PSCredential ($User , $SecurePass )
1410+
1411+
1412+
14541413
14551414# log
14561415write-output ' Creating Environment'
14571416# activity
1458- $AdminAadID = $user.Split (' @' )[1 ]
1459- $apiEndpointMetadata = Invoke-RestMethod - Uri https:// $apiEndpoint / metadata/ endpoints?api- version= 1.0 - Method Get
1460- $EnvAzureStackAdmin = Add-AzureRmEnvironment - Name ' AzureStackCloud' `
1461- - ActiveDirectoryEndpoint ($apiEndpointMetadata.authentication.loginEndpoint + $AdminAadID + ' /' ) `
1462- - ActiveDirectoryServiceEndpointResourceId $apiEndpointMetadata.authentication.audiences [0 ] `
1463- - ResourceManagerEndpoint " https://$apiEndpoint /" `
1464- - GalleryEndpoint $apiEndpointMetadata.galleryEndpoint `
1465- - GraphEndpoint $apiEndpointMetadata.graphEndpoint
1417+
1418+
1419+ $EnvAzureStackAdmin = Add-AzureRmEnvironment - Name ' AzureStackCloud' - ARMEndpoint https:// $apiEndpoint
14661420
14671421# log
14681422Write-Output ' Add account to environment'
14691423# activity
1470- $EnvAccountAzureStackAdmin = Add-AzureRmAccount - Environment $EnvAzureStackAdmin - Credential $AdminCreds
1471- $rmProfile = Select-AzureRmProfile - Profile $EnvAccountAzureStackAdmin
1424+ Add-AzureRmAccount - Environment $EnvAzureStackAdmin - TenantId $TenantID
1425+
14721426
1473- # log
1474- Write-Output ' Select default subscription'
1475- # activity
1476- $Subscription = Select-AzureRmSubscription - SubscriptionName ' Default Provider Subscription'
14771427
14781428# condition
14791429$Exists = Get-AzureRmResourceGroup - Name $ResourceGroup - Location $ResourceGroupLocation - ErrorAction SilentlyContinue
@@ -1539,7 +1489,7 @@ Remove-item $tempfolder -Force -Recurse
15391489$appName = ($manifest.publisher + ' .' + $manifest.name + ' .' + $manifest.version )
15401490
15411491# condition
1542- $Exists = Get-AzureRMGalleryItem - ErrorAction SilentlyContinue | where {$_.name -eq $appName }
1492+ $Exists = Get-AzsGalleryItem - ErrorAction SilentlyContinue | where {$_.name -eq $appName }
15431493if ($Exists ) {
15441494 Write-Output " The Publisher/Name/Version already exists"
15451495 Write-Output " Package not published"
@@ -1549,15 +1499,16 @@ Else {
15491499 # log
15501500 Write-Output ' Upload package to storage container'
15511501 # activity
1552- $blob = Set-AzureStorageBlobContent - Container $StorageContainerName - File $package - Context $StorageContext - Force
1502+ $blob = Set-AzureStorageBlobContent - Container $StorageContainerName - File $package - Context $StorageContext - Force
1503+
15531504 # log
15541505 Write-Output ' Publish package to Marketplace'
15551506 # activity
1556- $publish = Add-AzureRMGalleryItem - GalleryItemUri ($blob.context.BlobEndPoint + $StorageContainerName + ' /' + $blob.Name ) - Verbose
1507+ Add-AzsGalleryItem - GalleryItemUri ($blob.context.BlobEndPoint + $StorageContainerName + ' /' + $blob.Name ) - force
1508+
15571509 }
15581510
1559- if ($publish.StatusCode -eq ' 201' ){ write-output ' Completed succesfully' }
1560- else { write-output ' Publish item failed' }
1511+
15611512
15621513}
15631514
@@ -2028,24 +1979,13 @@ $X_Publish_Tbx_Package.Add_LostFocus({
20281979F_Validation - field ' X_Publish_Tbx_Package' - field_value $X_Publish_Tbx_Package.Text - extension ' .azpkg' - columnwidth 190
20291980})
20301981
2031- $X_Publish_Pwb_Password1.Add_LostFocus ({
2032- if ($X_Publish_Pwb_Password2.Password -ne ' ' ){
2033- F_Validation - field ' X_Publish_Pwb_Password1' - field_value $X_Publish_Pwb_Password1.Password - compare $X_Publish_Pwb_Password2.Password - columnwidth 258
2034- }
2035- })
20361982
2037- $X_Publish_Pwb_Password2.Add_LostFocus ({
2038- if ($X_Publish_Pwb_Password1.Password -ne ' ' ){
2039- F_Validation - field ' X_Publish_Pwb_Password2' - field_value $X_Publish_Pwb_Password2.Password - compare $X_Publish_Pwb_Password1.Password - columnwidth 258
2040- }
2041- })
20421983
20431984$X_Publish_Btn_Publish.Add_Click ({
20441985F_Validation - field ' X_Publish_Tbx_Package' - field_value $X_Publish_Tbx_Package.Text - empty - extension ' .azpkg' - columnwidth 190
2045- F_Validation - field ' X_Publish_Tbx_Username' - field_value $X_Publish_Tbx_Username.Text - empty - columnwidth 258
2046- F_Validation - field ' X_Publish_Pwb_Password1' - field_value $X_Publish_Pwb_Password1.Password - empty - compare $X_Publish_Pwb_Password2.Password - columnwidth 258
2047- F_Validation - field ' X_Publish_Pwb_Password2' - field_value $X_Publish_Pwb_Password2.Password - empty - compare $X_Publish_Pwb_Password1.Password - columnwidth 258
20481986F_Validation - field ' X_Publish_Tbx_Endpoint' - field_value $X_Publish_Tbx_Endpoint.Text - empty - columnwidth 258
1987+ F_Validation - field ' X_Publish_Tbx_Region' - field_value $X_Publish_Tbx_Region.Text - empty - columnwidth 258
1988+ F_Validation - field ' X_Publish_Tbx_TenantID' - field_value $X_Publish_Tbx_TenantID.Text - empty - columnwidth 258
20491989$validation = (Get-Variable | where {($_.name -match ' X_Publish_Tbx' ) -or ($_.name -match ' X_Publish_Pwb' )}).value.parent.children | where {$_.GetType ().fullname -eq ' System.Windows.Controls.Button' -and $_.Content -eq ' !' -and $_.visibility -eq ' visible' }
20501990if ((! ($validation )) -and ($Script :job.state -ne ' running' )){
20511991 $X_Publish_Lsv_Log.Items.Clear ()
@@ -2092,10 +2032,9 @@ $X_Dashboard.Visibility = 'Visible'
20922032$X_Wizard_Btn_Publish.Background = ' White'
20932033$X_Wizard_Btn_Input.Background = ' #B3EBFB'
20942034F_Validation - field ' X_Publish_Tbx_Package' - field_value $X_Publish_Tbx_Package.Text - columnwidth 190
2095- F_Validation - field ' X_Publish_Tbx_Username' - field_value $X_Publish_Tbx_Username.Text - columnwidth 258
2096- F_Validation - field ' X_Publish_Pwb_Password1' - field_value $X_Publish_Pwb_Password1.Password - columnwidth 258
2097- F_Validation - field ' X_Publish_Pwb_Password2' - field_value $X_Publish_Pwb_Password2.Password - columnwidth 258
20982035F_Validation - field ' X_Publish_Tbx_Endpoint' - field_value $X_Publish_Tbx_Endpoint.Text - columnwidth 258
2036+ F_Validation - field ' X_Publish_Tbx_Region' - field_value $X_Publish_Tbx_Region.Text - columnwidth 258
2037+ F_Validation - field ' X_Publish_Tbx_TenantID' - field_value $X_Publish_Tbx_TenantID.Text - columnwidth 258
20992038if ($script :job.id ){ remove-job $script :job.id - ErrorAction SilentlyContinue }
21002039})
21012040# endregion
0 commit comments