@@ -576,6 +576,11 @@ function DownloadMarketplaceProduct {
576576 } else {
577577 & ' C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' / Source:$Source / Dest:$tmpDestination / Y
578578 }
579+ # # Check $LastExitcode to see if AzCopy Succeeded
580+ if ($LastExitCode -ne 0 ) {
581+ $downloadError = $_
582+ Write-Error " Unable downloading files using AzCopy: $downloadError LastExitCode: $LastExitCode " - ErrorAction Stop
583+ }
579584 } else {
580585 $wc = New-Object System.Net.WebClient
581586 $wc.DownloadFile ($source , $tmpDestination )
@@ -682,6 +687,31 @@ function PreCheck
682687 Write-Warning " .marketplace file exists, these are temp files not fully downloaded. Please download product '$dir ' again, then retry import"
683688 throw " .marketplace file exists"
684689 }
690+
691+ # # Validate Json
692+ $jsonPath = " $folderPath \$dir .json"
693+ $configuration = Get-Content $jsonPath | ConvertFrom-Json
694+ $properties = ($configuration | Get-Member - MemberType NoteProperty).Name
695+ # # define required properties
696+ $requiredprops = @ (" displayName" , " publisherDisplayName" , " publisherIdentifier" , " galleryPackageBlobSasUri" , " offer" , " offerVersion" , " sku" , " productProperties" , " payloadLength" , " iconUris" , " productKind" )
697+ foreach ($property in $requiredprops ) {
698+ if ($configuration .$property ) {
699+ Write-Verbose - Message " $property = $ ( $configuration .$property ) "
700+ }
701+ else
702+ {
703+ Write-Error - Message " Property value for $property is null. Please check JSON contents, then retry import."
704+ throw " JSON file contains null values for required properties."
705+ }
706+ }
707+
708+ $iconUris = $configuration.iconUris
709+
710+ if ($iconUris.small -eq $null -or $iconUris.large -eq $null -or $iconUris.medium -eq $null -or $iconUris.wide -eq $null )
711+ {
712+ Write-Error - Message " Property value for certain Icons is null. Please check JSON contents, then retry import."
713+ throw " JSON file contains null values for certain Icons. Please ensure small, medium, large and wide icons exist in the JSON."
714+ }
685715 }
686716}
687717
0 commit comments