Skip to content

Commit

Permalink
VM issue correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivangi authored and Shivangi committed May 8, 2020
1 parent a775352 commit c12dbaf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
5 changes: 2 additions & 3 deletions Tasks/AzureFileCopyV4/AzureFileCopy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ try {
if([string]::IsNullOrEmpty($containerName) -or ($destination -ne "AzureBlob"))
{
$containerName = [guid]::NewGuid().ToString()
Create-AzureContainer -containerName $containerName -storageContext $storageContext -isPremiumStorage $isPremiumStorage

Create-AzureContainer -containerName $containerName -storageContext $storageContext -isPremiumStorage $isPremiumStorage
}
else
{
#checking if the containerName provided exist or not
$containerPresent = Get-AzureContainer -containerName $containerName -storageContext $storageContext -isPremiumStorage $isPremiumStorage
$containerPresent = Get-AzureContainer -containerName $containerName -storageContext $storageContext

#creating container if the containerName provided does not exist
if([string]::IsNullOrEmpty($containerPresent) )
Expand Down
10 changes: 6 additions & 4 deletions Tasks/AzureFileCopyV4/AzureFileCopyRemoteJob.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ $AzureFileCopyRemoteJob = {
$shouldDownload = $true
}

$azCopyFolderName = "ADO_AzCopyV10"
$azCopyFolderPath = Join-Path -Path $env:systemdrive -ChildPath $azCopyFolderName

if($shouldDownload)
{
try
{
$azCopyFolderName = "ADO_AzCopyV10"
$azCopyFolderPath = Join-Path -Path $env:systemdrive -ChildPath $azCopyFolderName
New-Item -ItemType Directory -Force -Path $azCopyFolderPath
$azCopyZipPath = Join-Path -Path $azCopyFolderPath -ChildPath "AzCopy.zip"

Expand Down Expand Up @@ -92,9 +93,10 @@ $AzureFileCopyRemoteJob = {
$additionalArguments = "--recursive --log-level=INFO"
}

Write-DetailLogs "##[command] & azcopy copy `"$containerURL*****`" `"$targetPath`" $additionalArguments"
$azCopyExeLocation = Join-Path -Path $azCopyFolderPath -ChildPath "AzCopy\AzCopy.exe"
Write-DetailLogs "##[command] & `"$azCopyExeLocation`" copy `"$containerURL*****`" `"$targetPath`" $additionalArguments"

$azCopyCommand = "& azcopy copy `"$containerURL/*$containerSasToken`" `"$targetPath`" $additionalArguments"
$azCopyCommand = "& `"$azCopyExeLocation`" copy `"$containerURL/*$containerSasToken`" `"$targetPath`" $additionalArguments"
Invoke-Expression $azCopyCommand
}
catch
Expand Down
13 changes: 4 additions & 9 deletions Tasks/AzureFileCopyV4/AzureUtilityARM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ function Create-AzureContainer
function Get-AzureContainer
{
param([string]$containerName,
[object]$storageContext,
[boolean]$isPremiumStorage)
[object]$storageContext)

$container = $null

Expand All @@ -74,13 +73,9 @@ function Get-AzureContainer
$storageAccountName = $storageContext.StorageAccountName

Write-Verbose "[Azure Call]Getting container: $containerName in storage account: $storageAccountName"
try{
if ($isPremiumStorage)
{
$container = Get-AzureStorageContainer -Name $containerName -Context $storageContext -ErrorAction Stop
} else {
$container = Get-AzureStorageContainer -Name $containerName -Context $storageContext -Permission Container -ErrorAction Stop
}
try
{
$container = Get-AzureStorageContainer -Name $containerName -Context $storageContext -ErrorAction Stop
}
catch
{
Expand Down
13 changes: 4 additions & 9 deletions Tasks/AzureFileCopyV4/AzureUtilityAz1.0.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ function Create-AzureContainer
function Get-AzureContainer
{
param([string]$containerName,
[object]$storageContext,
[boolean]$isPremiumStorage)
[object]$storageContext)

$container = $null

Expand All @@ -75,13 +74,9 @@ function Get-AzureContainer
$storageAccountName = $storageContext.StorageAccountName

Write-Verbose "[Azure Call]Getting container: $containerName in storage account: $storageAccountName"
try{
if ($isPremiumStorage)
{
$container = Get-AzStorageContainer -Name $containerName -Context $storageContext -ErrorAction Stop
} else {
$container = Get-AzStorageContainer -Name $containerName -Context $storageContext -Permission Container -ErrorAction Stop
}
try
{
$container = Get-AzStorageContainer -Name $containerName -Context $storageContext -ErrorAction Stop
}
catch
{
Expand Down

0 comments on commit c12dbaf

Please sign in to comment.