Skip to content

Commit df217ad

Browse files
committed
Update quickstart CLI to be native CLI
1 parent 94e3022 commit df217ad

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

articles/firmware-analysis/quickstart-upload-firmware-using-azure-command-line-interface.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,32 +49,37 @@ The output of this command includes a `name` property, which is your firmware ID
4949
2. Generate a SAS URL, which you'll use in the next step to send your firmware image to Azure Storage. Replace `sampleFirmwareID` with the firmware ID that you saved from the previous step. You can store the SAS URL in a variable for easier access for future commands:
5050
5151
```azurecli
52-
$sasURL = $(az firmwareanalysis workspace generate-upload-url --resource-group myResourceGroup --subscription 123e4567-e89b-12d3-a456-426614174000 --workspace-name default --firmware-id sampleFirmwareID --query "url")
52+
set resourceGroup=myResourceGroup
53+
set subscription=123e4567-e89b-12d3-a456-426614174000
54+
set workspace=default
55+
set firmwareID=sampleFirmwareID
56+
57+
for /f "tokens=*" %i in ('az firmwareanalysis workspace generate-upload-url --resource-group %resourceGroup% --subscription %subscription% --workspace-name %workspace% --firmware-id %firmwareID% --query "url"') do set sasURL=%i
5358
```
5459
5560
3. Upload your firmware image to Azure Storage. Replace `pathToFile` with the path to your firmware image on your local machine.
5661
5762
```azurecli
58-
az storage blob upload -f pathToFile --blob-url $sasURL
63+
az storage blob upload -f pathToFile --blob-url %sasURL%
5964
```
6065
6166
Here's an example workflow of how you could use these commands to create and upload a firmware image. To learn more about using variables in CLI commands, visit [How to use variables in Azure CLI commands](/cli/azure/azure-cli-variables?tabs=bash):
6267
6368
```azurecli
64-
$filePath='/path/to/image'
65-
$resourceGroup='myResourceGroup'
66-
$workspace='default'
69+
set filePath="/path/to/image"
70+
set resourceGroup="myResourceGroup"
71+
set workspace="default"
6772
68-
$fileName='file1'
69-
$vendor='vendor1'
70-
$model='model'
71-
$version='test'
73+
set fileName="file1"
74+
set vendor="vendor1"
75+
set model="model"
76+
set version="test"
7277
73-
$FWID=$(az firmwareanalysis firmware create --resource-group $resourceGroup --workspace-name $workspace --file-name $fileName --vendor $vendor --model $model --version $version --query "name")
78+
for /f "tokens=*" %i in ('az firmwareanalysis firmware create --resource-group %resourceGroup% --workspace-name %workspace% --file-name %fileName% --vendor %vendor% --model %model% --version %version% --query "name"') do set FWID=%i
7479
75-
$URL=$(az firmwareanalysis workspace generate-upload-url --resource-group $resourceGroup --workspace-name $workspace --firmware-id $FWID --query "url")
80+
for /f "tokens=*" %i in ('az firmwareanalysis workspace generate-upload-url --resource-group %resourceGroup% --workspace-name %workspace% --firmware-id %FWID% --query "url"') do set URL=%i
7681
77-
$OUTPUT=(az storage blob upload -f $filePath --blob-url $URL)
82+
az storage blob upload -f %filePath% --blob-url %URL%
7883
```
7984

8085
## Retrieve firmware analysis results
@@ -92,15 +97,19 @@ If you would like to automate the process of checking your analysis's status, yo
9297
The `az resource wait` command has a `--timeout` parameter, which is the time in seconds that the analysis will end if "status" does not reach "Ready" within the timeout frame. The default timeout is 3600, which is one hour. Large images may take longer to analyze, so you can set the timeout using the `--timeout` parameter according to your needs. Here's an example of how you can use the `az resource wait` command with the `--timeout` parameter to automate checking your analysis's status, assuming that you have already created a firmware and stored the firmware ID in a variable named `$FWID`:
9398

9499
```azurecli
95-
$ID=$(az firmwareanalysis firmware show --resource-group $resourceGroup --workspace-name $workspace --firmware-id $FWID --query "id")
100+
set resourceGroup="myResourceGroup"
101+
set workspace="default"
102+
set FWID="yourFirmwareID"
103+
104+
for /f "tokens=*" %i in ('az firmwareanalysis firmware show --resource-group %resourceGroup% --workspace-name %workspace% --firmware-id %FWID% --query "id"') do set ID=%i
96105
97-
Write-Host (‘Successfully created a firmware image with the firmware ID of ‘ + $FWID + ‘, recognized in Azure by this resource ID: ‘ + $ID + ‘.’)
106+
echo Successfully created a firmware image with the firmware ID of %FWID%, recognized in Azure by this resource ID: %ID%.
98107
99-
$WAIT=$(az resource wait --ids $ID --custom "properties.status=='Ready'" --timeout 10800)
108+
for /f "tokens=*" %i in ('az resource wait --ids %ID% --custom "properties.status=='Ready'" --timeout 10800') do set WAIT=%i
100109
101-
$STATUS=$(az resource show --ids $ID --query 'properties.status')
110+
for /f "tokens=*" %i in ('az resource show --ids %ID% --query "properties.status"') do set STATUS=%i
102111
103-
Write-Host ('Firmware analysis completed with status: ' + $STATUS)
112+
echo Firmware analysis completed with status: %STATUS%
104113
```
105114

106115
Once you've confirmed that your analysis status is "Ready", you can run commands to pull the results.

0 commit comments

Comments
 (0)