Fix for Token
This commit is contained in:
Родитель
509fcb9c8e
Коммит
d3e9a0a164
|
@ -57,7 +57,7 @@ function Sync-AzSOfflineMarketplaceItems{
|
||||||
$registration = $registrations[0]
|
$registration = $registrations[0]
|
||||||
|
|
||||||
# Retrieve the access token
|
# Retrieve the access token
|
||||||
$tokens = [Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache]::DefaultShared.ReadItems()
|
$tokens = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.TokenCache.ReadItems()
|
||||||
$token = $tokens |Where Resource -EQ $azureEnvironment.ActiveDirectoryServiceEndpointResourceId |Where DisplayableId -EQ $azureAccount.Context.Account.Id |Sort ExpiresOn |Select -Last 1
|
$token = $tokens |Where Resource -EQ $azureEnvironment.ActiveDirectoryServiceEndpointResourceId |Where DisplayableId -EQ $azureAccount.Context.Account.Id |Sort ExpiresOn |Select -Last 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,10 +132,17 @@ $Marketitems|Out-GridView -Title 'Azure Marketplace Items' -PassThru|foreach{
|
||||||
# download azpkg
|
# download azpkg
|
||||||
$azpkgsource = $downloadDetails.galleryPackageBlobSasUri
|
$azpkgsource = $downloadDetails.galleryPackageBlobSasUri
|
||||||
$FileExists=Test-Path "$destination\$azpkgName.azpkg"
|
$FileExists=Test-Path "$destination\$azpkgName.azpkg"
|
||||||
|
$DestinationCheck=Test-Path $destination
|
||||||
|
If ($DestinationCheck -eq $false)
|
||||||
|
{
|
||||||
|
new-item -ItemType Directory -force $destination} else{}
|
||||||
|
|
||||||
If ($FileExists -eq $true) {Remove-Item "$destination\$azpkgName.azpkg" -force} else {
|
If ($FileExists -eq $true) {Remove-Item "$destination\$azpkgName.azpkg" -force} else {
|
||||||
New-Item "$destination\$azpkgName.azpkg"}
|
New-Item "$destination\$azpkgName.azpkg"}
|
||||||
$azpkgdestination = "$destination\$azpkgName.azpkg"
|
$azpkgdestination = "$destination\$azpkgName.azpkg"
|
||||||
Start-BitsTransfer -source $azpkgsource -destination $azpkgdestination -Priority High
|
Start-BitsTransfer -source $azpkgsource -destination $azpkgdestination -Priority High
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# download vhd
|
# download vhd
|
||||||
$vhdName = $productDetails.properties.galleryItemIdentity
|
$vhdName = $productDetails.properties.galleryItemIdentity
|
||||||
|
|
Загрузка…
Ссылка в новой задаче