Skip to content

Commit d985ce8

Browse files
yunzhangMSknithinc
authored andcommitted
use clear webclient variable to call download function. (#489)
* use clear webclient variable to call download function. * fix a typo. * remove dependency in Test-AzSOfflineMarketplaceItem. * add indication where parameters need to be provided.
1 parent 5efdfc2 commit d985ce8

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

Syndication/AzureStack.MarketplaceSyndication.psm1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ function DownloadMarketplaceProduct {
505505
if ($PremiumDownload) {
506506
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$Source /Dest:$tmpDestination /Y /CheckMD5
507507
} else {
508-
(New-Object System.Net.WebClient).DownloadFile("$Source",$tmpDestination)
508+
$wc = New-Object System.Net.WebClient
509+
$wc.DownloadFile($Source, $tmpDestination)
509510
}
510511

511512
$completed = $true
@@ -691,15 +692,14 @@ function Import-ByDependency
691692
function Test-AzSOfflineMarketplaceItem {
692693
param (
693694
[parameter(mandatory = $true)]
694-
[String] $Destination
695-
)
695+
[String] $Destination,
696696

697-
Import-Module C:\CloudDeployment\ECEngine\EnterpriseCloudEngine.psd1 -ErrorAction Stop
698-
$engine = New-Object CloudEngine.Engine.DefaultECEngine
699-
$roles = $engine.GetRolesPublicInfo()
700-
$WASRoleDefinition = $roles["WAS"].PublicConfiguration
701-
$armEndpoint = (($WASRoleDefinition.PublicInfo.Endpoints.Endpoint | Where Name -EQ "ResourceManager").Address).Trim('/')
702-
$defaultProviderSubscription = Get-AzureRmSubscription -SubscriptionName 'Default Provider Subscription' | Select-AzureRmSubscription
697+
[parameter(mandatory = $true)]
698+
[String] $ArmEndpoint,
699+
700+
[parameter(mandatory = $true)]
701+
[String] $SubscriptionId
702+
)
703703

704704
$ctx = Get-AzureRmContext
705705
$AccessToken = Resolve-AccessToken -Context $ctx -AccessToken $AccessToken
@@ -709,8 +709,8 @@ function Test-AzSOfflineMarketplaceItem {
709709
foreach($product in $dirs)
710710
{
711711
$syndicateUri = [string]::Format("{0}/subscriptions/{1}/resourceGroups/azurestack-activation/providers/Microsoft.AzureBridge.Admin/activations/default/downloadedProducts/{2}?api-version=2016-01-01",
712-
$armEndpoint,
713-
$defaultProviderSubscription.subscription.id,
712+
$ArmEndpoint,
713+
$SubscriptionId,
714714
$product
715715
)
716716

Syndication/readme.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Get-AzureRmSubscription -SubscriptionID '<Your Azure Subscription GUID>' | Selec
3838
Import the module and start the export process for an Azure Marketplace item
3939
```powershell
4040
Import-Module .\AzureStack.MarketplaceSyndication.psm1
41-
Export-AzSOfflineMarketplaceItem -destination "Destination folder path"
41+
Export-AzSOfflineMarketplaceItem -destination "[Destination folder path]"
4242
```
4343

4444
You will be prompted to select an Azure Marketplace item to download locally.
@@ -48,22 +48,23 @@ After download completion, the item will be available in the folder specified in
4848

4949

5050
## Validating the downloaded Azure Marketplace item
51-
The following command will run a set of test against a downloaded Azure Marketplace item. It is highly recommended to validate the download before proceeding to the next steps
51+
Configure Azure Stack Operator’s PowerShell session. More information can be found here https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-configure-admin
52+
The following command will run a set of test against a downloaded Azure Marketplace item. It is highly recommended to validate the download before proceeding to the next steps.
5253
```powershell
53-
Test-AzSOfflineMarketplaceItem -Destination "marketplace content folder"
54+
Test-AzSOfflineMarketplaceItem -Destination "[marketplace content folder]" -Armendpoint "[Environment Arm Endpoint]" -SubscriptionId "[Default Provider Subscription Id]"
5455
```
5556

5657
## Importing the downloaded Azure Marketplace item to your Azure Stack Marketplace
5758
The previous downloaded files will need to be made available to your Azure Stack environment. The following structure showcase how the folder structure and files should look like
5859
![](downloadedfiles.png)
5960

60-
Configure Azure Stack Operator’s PowerShell session. More information cannot be found here https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-configure-admin
61+
Configure Azure Stack Operator’s PowerShell session. More information can be found here https://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-powershell-configure-admin
6162

6263
Import the module and start the import process for an Azure Marketplace item
6364
```powershell
6465
Import-Module .\AzureStack.MarketplaceSyndication.psm1
6566
$credential = Get-Credential -Message "Enter the azure stack operator credential"
66-
Import-AzSOfflineMarketplaceItem -origin “marketplace content folder" -armendpoint "Environment Arm Endpoint" -AzsCredential $credential
67+
Import-AzSOfflineMarketplaceItem -origin “[marketplace content folder]" -armendpoint "[Environment Arm Endpoint]" -AzsCredential $credential
6768
```
6869

6970
Option -Origin needs to be the top level folder contains all the downloaded products. In the example above, Origin should be "D:\downloadfolder".

0 commit comments

Comments
 (0)