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.
This commit is contained in:
Yun Zhang 2019-01-09 11:14:55 -08:00 коммит произвёл Krishna Nithin
Родитель 5efdfc2294
Коммит d985ce8741
2 изменённых файлов: 17 добавлений и 16 удалений

Просмотреть файл

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

Просмотреть файл

@ -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.
@ -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 Operators 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 Operators 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 Operators 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".