Skip to content

Commit

Permalink
use clear webclient variable to call download function. (#489)
Browse files Browse the repository at this point in the history
* use clear webclient variable to call download function.

* fix a typo.

* remove dependency in Test-AzSOfflineMarketplaceItem.

* add indication where parameters need to be provided.
  • Loading branch information
yunzhangMS authored and knithinc committed Jan 9, 2019
1 parent 5efdfc2 commit d985ce8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
22 changes: 11 additions & 11 deletions Syndication/AzureStack.MarketplaceSyndication.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ function DownloadMarketplaceProduct {
if ($PremiumDownload) {
& 'C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe' /Source:$Source /Dest:$tmpDestination /Y /CheckMD5
} else {
(New-Object System.Net.WebClient).DownloadFile("$Source",$tmpDestination)
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($Source, $tmpDestination)
}

$completed = $true
Expand Down Expand Up @@ -691,15 +692,14 @@ function Import-ByDependency
function Test-AzSOfflineMarketplaceItem {
param (
[parameter(mandatory = $true)]
[String] $Destination
)
[String] $Destination,

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

[parameter(mandatory = $true)]
[String] $SubscriptionId
)

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

Expand Down
11 changes: 6 additions & 5 deletions Syndication/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Get-AzureRmSubscription -SubscriptionID '<Your Azure Subscription GUID>' | Selec
Import the module and start the export process for an Azure Marketplace item
```powershell
Import-Module .\AzureStack.MarketplaceSyndication.psm1
Export-AzSOfflineMarketplaceItem -destination "Destination folder path"
Export-AzSOfflineMarketplaceItem -destination "[Destination folder path]"
```

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


## Validating the downloaded Azure Marketplace item
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
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
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.
```powershell
Test-AzSOfflineMarketplaceItem -Destination "marketplace content folder"
Test-AzSOfflineMarketplaceItem -Destination "[marketplace content folder]" -Armendpoint "[Environment Arm Endpoint]" -SubscriptionId "[Default Provider Subscription Id]"
```

## Importing the downloaded Azure Marketplace item to your Azure Stack Marketplace
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
![](downloadedfiles.png)

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
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

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

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

0 comments on commit d985ce8

Please sign in to comment.