Skip to content

Commit 077a46d

Browse files
authored
Merge pull request #2 from microsoft/vscode-http-client
feat: Use a VS Code extension to test the uploader function
2 parents dd14089 + c709166 commit 077a46d

File tree

7 files changed

+26
-6
lines changed

7 files changed

+26
-6
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
"ms-azuretools.azure-dev",
4242
"ms-azuretools.vscode-azurefunctions",
4343
// Bicep
44-
"ms-azuretools.vscode-bicep"
44+
"ms-azuretools.vscode-bicep",
45+
// HTTP client
46+
"humao.rest-client"
4547
]
4648
}
4749
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,6 @@ paket-files/
317317
__pycache__/
318318
*.pyc
319319
.azure
320+
321+
# Environment variables
322+
.env

audioupload.http

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
POST https://{{$dotenv AZURE_UPLOADER_FUNCTION_APP_NAME}}.azurewebsites.net/api/AudioUpload HTTP/1.1
2+
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
3+
4+
------WebKitFormBoundary7MA4YWxkTrZu0gW
5+
Content-Disposition: form-data; name="audio"; filename="MicrosoftAI.wav"
6+
Content-Type: audio/wav
7+
8+
< ./docs/assets/audios/MicrosoftAI.wav
9+
------WebKitFormBoundary7MA4YWxkTrZu0gW--
95.3 KB
Loading

docs/workshop.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ To test the environment setup, we will upload an audio file using the uploader f
202202

203203
</details>
204204

205-
Inside VS Code, use the following command to upload an audio file to the audio's storage account with the uploader function:
205+
Inside VS Code, open the `audioupload.http` file located on the root directory, then click on the `Send Request` button.
206+
This will send a request to the uploader function to upload an audio file to the audio's storage account:
206207

207-
```sh
208-
curl -v -F audio=@\./docs/assets/audios/MicrosoftAI.wav https://${AZURE_UPLOADER_FUNCTION_APP_NAME}.azurewebsites.net/api/AudioUpload
209-
```
208+
![Uploading a file from VS Code](assets/vscode-upload-audio-file.png)
210209

210+
A loader will appear on the Status Bar (at the bottom) to indicate that the upload is in progress.
211211
Wait for the request to finish then make sure the audio file was uploaded to the `audios` container which you have checked at the beginning.
212212

213-
The following sample audio files are provided in the workshop, so feel free to retry testing the uploader function with another file:
213+
The following sample audio files are provided in the workshop, so feel free to retry testing the uploader function with another file by updating the `audioupload.http` file:
214214

215215
- [Azure Functions](assets/audios/AzureFunctions.wav)
216216
- [Microsoft AI](assets/audios/MicrosoftAI.wav)

scripts/post-up.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ $filter="/blobServices/default/containers/" + ${env:AUDIOS_STORAGE_ACCOUNT_CONTA
1919
az eventgrid system-topic event-subscription create -n audio-files-topic-subscription -g ${env:RESOURCE_GROUP} --system-topic-name ${env:AUDIOS_EVENTGRID_SYSTEM_TOPIC_NAME} --endpoint-type webhook --endpoint $endpointUrl --included-event-types Microsoft.Storage.BlobCreated --subject-begins-with $filter
2020

2121
Write-Output "Created blob event grid subscription successfully."
22+
23+
# Load azd environment variables to .env file for testing deployed functions
24+
azd env get-values > .env

scripts/post-up.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ filter="/blobServices/default/containers/${AUDIOS_STORAGE_ACCOUNT_CONTAINER_NAME
2121
az eventgrid system-topic event-subscription create -n "audio-files-topic-subscription" -g "${RESOURCE_GROUP}" --system-topic-name "${AUDIOS_EVENTGRID_SYSTEM_TOPIC_NAME}" --endpoint-type "webhook" --endpoint "$endpointUrl" --included-event-types "Microsoft.Storage.BlobCreated" --subject-begins-with "$filter"
2222

2323
echo "Created blob event grid subscription successfully."
24+
25+
# Load azd environment variables to .env file for testing deployed functions
26+
azd env get-values > .env

0 commit comments

Comments
 (0)