Skip to content

Commit d3e9a0a

Browse files
committed
Fix for Token
1 parent 509fcb9 commit d3e9a0a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Syndication/AzureStack.MarketplaceSyndication.psm1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function Sync-AzSOfflineMarketplaceItems{
5757
$registration = $registrations[0]
5858

5959
# Retrieve the access token
60-
$tokens = [Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache]::DefaultShared.ReadItems()
60+
$tokens = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance.TokenCache.ReadItems()
6161
$token = $tokens |Where Resource -EQ $azureEnvironment.ActiveDirectoryServiceEndpointResourceId |Where DisplayableId -EQ $azureAccount.Context.Account.Id |Sort ExpiresOn |Select -Last 1
6262

6363

@@ -132,10 +132,17 @@ $Marketitems|Out-GridView -Title 'Azure Marketplace Items' -PassThru|foreach{
132132
# download azpkg
133133
$azpkgsource = $downloadDetails.galleryPackageBlobSasUri
134134
$FileExists=Test-Path "$destination\$azpkgName.azpkg"
135+
$DestinationCheck=Test-Path $destination
136+
If ($DestinationCheck -eq $false)
137+
{
138+
new-item -ItemType Directory -force $destination} else{}
139+
135140
If ($FileExists -eq $true) {Remove-Item "$destination\$azpkgName.azpkg" -force} else {
136141
New-Item "$destination\$azpkgName.azpkg"}
137142
$azpkgdestination = "$destination\$azpkgName.azpkg"
138143
Start-BitsTransfer -source $azpkgsource -destination $azpkgdestination -Priority High
144+
145+
139146

140147
# download vhd
141148
$vhdName = $productDetails.properties.galleryItemIdentity

0 commit comments

Comments
 (0)