Skip to content

Commit 499995f

Browse files
Adding Pwsh commands
Adding Pwsh commands and providing example of how to invoke azcopy inline. Pwsh requires the -SkipHttpErrorCheck to continue due to the redirect (301).
1 parent 6ce03df commit 499995f

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

articles/storage/common/storage-use-azcopy-v10.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,33 @@ To obtain the link, run this command:
150150
| Operating system | Command |
151151
|--------|-----------|
152152
| **Linux** | `curl -s -D- https://aka.ms/downloadazcopy-v10-linux | grep ^Location` |
153-
| **Windows** | `(curl https://aka.ms/downloadazcopy-v10-windows -MaximumRedirection 0 -ErrorAction silentlycontinue).headers.location` |
153+
| **Windows PowerShell** | `(Invoke-WebRequest https://aka.ms/downloadazcopy-v10-windows -MaximumRedirection 0 -ErrorAction SilentlyContinue).headers.location` |
154+
| **PowerShell Core** | `(Invoke-WebRequest https://aka.ms/downloadazcopy-v10-windows -MaximumRedirection 0 -ErrorAction SilentlyContinue -SkipHttpErrorCheck).headers.location` |
154155

155156
> [!NOTE]
156157
> For Linux, `--strip-components=1` on the `tar` command removes the top-level folder that contains the version name, and instead extracts the binary directly into the current folder. This allows the script to be updated with a new version of `azcopy` by only updating the `wget` URL.
157158
158159
The URL appears in the output of this command. Your script can then download AzCopy by using that URL.
159160

160-
| Operating system | Command |
161-
|--------|-----------|
162-
| **Linux** | `wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1` |
163-
| **Windows** | `Invoke-WebRequest https://azcopyvnext.azureedge.net/release20190517/azcopy_windows_amd64_10.1.2.zip -OutFile azcopyv10.zip <<Unzip here>>` |
161+
**Linux**
162+
```bash
163+
wget -O azcopy_v10.tar.gz https://aka.ms/downloadazcopy-v10-linux && tar -xf azcopy_v10.tar.gz --strip-components=1
164+
```
165+
**Windows PowerShell**
166+
```PowerShell
167+
Invoke-WebRequest 'https://azcopyvnext.azureedge.net/release20220315/azcopy_windows_amd64_10.14.1.zip' -OutFile 'azcopyv10.zip'
168+
Expand-archive -Path '.\azcopyv10.zip' -Destinationpath '.\'
169+
$AzCopy = (Get-ChildItem -path '.\' -Recurse -File -Filter 'azcopy.exe').FullName
170+
# Invoke AzCopy
171+
& $AzCopy
172+
```
173+
**PowerShell Core**
174+
```PowerShell
175+
Invoke-WebRequest 'https://azcopyvnext.azureedge.net/release20220315/azcopy_windows_amd64_10.14.1.zip' -OutFile 'azcopyv10.zip'
176+
$AzCopy = (Expand-archive -Path '.\azcopyv10.zip' -Destinationpath '.\' -PassThru | where-object {$_.Name -eq 'azcopy.exe'}).FullName
177+
# Invoke AzCopy
178+
& $AzCopy
179+
```
164180

165181
#### Escape special characters in SAS tokens
166182

0 commit comments

Comments
 (0)