Skip to content

Commit

Permalink
Skills measured as of October 11, 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
arvigeus committed Oct 27, 2024
1 parent a1c0d83 commit a52780a
Show file tree
Hide file tree
Showing 32 changed files with 1,000 additions and 761 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Build and run a container image by using Azure Container Registry Tasks

In this exercise you use ACR Tasks to perform the following actions:
In this exercise, you use ACR Tasks to perform the following actions:

- Create an Azure Container Registry
- Create an Azure Container Registry (ACR)
- Build and push image from a Dockerfile
- Verify the results
- Run the image in the ACR
Expand All @@ -23,7 +23,7 @@ In this exercise you use ACR Tasks to perform the following actions:

## Create an Azure Container Registry

1. Create a resource group for the registry, replace `<myLocation>` in the following command with a location near you.
1. Create a resource group for the registry. Replace `<myLocation>` in the following command with a location near you.

```sh
az group create --name az204-acr-rg --location <myLocation>
Expand Down Expand Up @@ -108,7 +108,7 @@ Now use Azure Container Registry to build and push an image based on a local Doc

## Run the image in the ACR

1. Run the sample/hello-world:v1 container image from your container registry by using the `az acr run` command. The following example uses `$Registry` to specify the registry where you run the command. Replace `<myContainerRegistry>` with the name you used earlier.
1. Run the `sample/hello-world:v1` container image from your container registry by using the `az acr run` command. The following example uses `$Registry` to specify the registry where you run the command. Replace `<myContainerRegistry>` with the name you used earlier.

```sh
az acr run --registry <myContainerRegistry> \
Expand All @@ -117,7 +117,7 @@ Now use Azure Container Registry to build and push an image based on a local Doc

The `cmd` parameter in this example runs the container in its default configuration, but `cmd` supports other `docker run` parameters or even other `docker` commands.

The following is shortened sample of the output:
The following sample output is shortened:

```txt
Packing source code into tar to upload...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In this exercise you learn how to:
- An **Azure account** with an active subscription. If you don't already have one, you can sign up for a free trial at <https://azure.com/free>.
- [Visual Studio Code](https://code.visualstudio.com/) on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms).
- The [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) for Visual Studio Code.
- [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) is the target framework for this exercise.
- [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) is the target framework for this exercise.

## Create Azure resources

Expand All @@ -22,7 +22,7 @@ In this exercise you learn how to:
az group create --name az204-redis-rg --location <myLocation>
```

1. Create an Azure Cache for Redis instance by using the `az redis create` command. The instance name needs to be unique and the script below will attempt to generate one for you, replace `<myLocation>` with the region you used in the previous step. This command takes a few minutes to complete.
1. Create an Azure Cache for Redis instance by using the `az redis create` command. The instance name needs to be unique and the following script attempts to generate one for you, replace `<myLocation>` with the region you used in the previous step. This command takes a few minutes to complete.

```sh
redisName=az204redis$RANDOM
Expand All @@ -34,11 +34,11 @@ In this exercise you learn how to:

1. In the Azure portal, navigate to the new Redis Cache you created.

1. Select **Access keys** in the **Settings** section of the Navigation Pane and leave the portal open. Copy the P**rimary connection string (StackExchange.Redis)** value to use in the app later.
1. Select **Access keys** in the **Settings**/**Authentication** section of the Navigation Pane and leave the portal open. Copy the **Primary connection string (StackExchange.Redis)** value to use in the app later.

## Create the console application

1. Create a console app by running the command below in the Visual Studio Code terminal.
1. Create a console app by running the following command in the Visual Studio Code terminal.

```sh
dotnet new console -o Rediscache
Expand Down Expand Up @@ -74,7 +74,7 @@ In this exercise you learn how to:

// Snippet below executes a PING to test the server connection
var result = await db.ExecuteAsync("ping");
Console.WriteLine($"PING = {result.Type} : {result}");
Console.WriteLine($"PING = {result.Resp2Type} : {result}");

// Call StringSetAsync on the IDatabase object to set the key "test:key" to the value "100"
bool setValue = await db.StringSetAsync("test:key", "100");
Expand All @@ -86,14 +86,14 @@ In this exercise you learn how to:
}
```

1. In the Visual Studio Code terminal, run the commands below to build the app to check for errors, and then run the app using the commands below
1. In the Visual Studio Code terminal, run the following commands to build and run the app.

```sh
dotnet build
dotnet run
```

1. The output should be similar to the following:
1. The output should be similar to the following example:

```txt
PING = SimpleString : PONG
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create Azure Cosmos DB resources by using the Azure portal

In this exercise you'll learn how to perform the following actions in the Azure portal:
In this exercise you learn how to perform the following actions in the Azure portal:

- Create an Azure Cosmos DB account
- Add a database and a container
Expand All @@ -13,7 +13,7 @@ In this exercise you'll learn how to perform the following actions in the Azure

## Create an Azure Cosmos DB account

1. Log in to the [Azure portal](https://portal.azure.com/).
1. Sign-in to the [Azure portal](https://portal.azure.com/).
1. From the Azure portal navigation pane, select _+ Create a resource_.
1. Search for **Azure Cosmos DB**, then select **Create/Azure Cosmos DB** to get started.
1. On the **Which API best suits your workload?** page, select **Create** in the **Azure Cosmos DB for NoSQL** box.
Expand All @@ -22,6 +22,7 @@ In this exercise you'll learn how to perform the following actions in the Azure
- **Subscription**: Select the subscription you want to use.
- **Resource Group**: Select **Create new**, then enter _az204-cosmos-rg_.
- **Account Name**: Enter a _unique_ name to identify your Azure Cosmos account. The name can only contain lowercase letters, numbers, and the hyphen (-) character. It must be between 3-31 characters in length.
- **Availability Zones**: Select **Disable**.
- **Location**: Use the location that is closest to your users to give them the fastest access to the data.
- **Capacity mode**: Select **Serverless**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This exercise uses the Azure Blob storage client library to show you how to perf

- [Visual Studio Code](https://code.visualstudio.com/) on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms).

- [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) is the target framework for the steps below.
- [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) is the target framework for the exercise.

- The [C# extension](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) for Visual Studio Code.

Expand All @@ -24,7 +24,7 @@ Perform the following actions to prepare Azure, and your local environment, for

1. Start Visual Studio Code and open a terminal window by selecting **Terminal** from the top application bar, then selecting **New Terminal**.

1. Login to Azure by using the command below. A browser window should open letting you choose which account to login with.
1. Sign in to Azure by using the following command. A browser window should open letting you choose which account to sign in with.

```sh
az login
Expand All @@ -36,7 +36,7 @@ Perform the following actions to prepare Azure, and your local environment, for
az group create --location <myLocation> --name az204-blob-rg
```

1. Create a storage account. We need a storage account created to use in the application. Replace `<myLocation>` with the same region you used for the resource group. Replace `<myStorageAcct>` with a unique name.
1. Create a storage account. Create a storage account to use in the application. Replace `<myLocation>` with the same region you used for the resource group. Replace `<myStorageAcct>` with a unique name.

```sh
az storage account create --resource-group az204-blob-rg --name <myStorageAcct> --location <myLocation> --sku Standard_LRS
Expand All @@ -49,14 +49,18 @@ Perform the following actions to prepare Azure, and your local environment, for
- Navigate to the [Azure portal](https://portal.azure.com/).
- Locate the storage account created.
- Select **Access keys** in the **Security + networking** section of the navigation pane. Here, you can view your account access keys and the complete connection string for each key.
- Find the **Connection string** value under **key1**, and select the **Copy** button to copy the connection string. You will add the connection string value to the code in the next section.
- Find the **Connection string** value under **key1**, and select the **Copy** button to copy the connection string. You'll add the connection string value to the code in the next section.
- In the **Blob** section of the storage account overview, select **Containers**. Leave the windows open so you can view changes made to the storage as you progress through the exercise.

## Prepare the .NET project

In this section we'll create project named az204-blob and install the Azure Blob Storage client library.
:bangbang: The code in this project uses a connection string to authorize access to your storage account. This configuration is for example purposes. Connection strings and account access keys should be used with caution in application code. If your account access key is lost or accidentally placed in an insecure location, your service may become vulnerable. Anyone who has the access key is able to authorize requests against the storage account, and effectively has access to all the data.

1. In the VS Code terminal navigate to a directory where you want to store your project.
For optimal security, Microsoft recommends using managed identities for Azure resources to authorize requests against blob, queue, and table data, whenever possible. To learn more, see [Authorize access to blobs using Microsoft Entra ID](https://learn.microsoft.com/en-us/azure/storage/blobs/authorize-access-azure-active-directory).

Create project named _az204-blob_ and install the Azure Blob Storage client library.

1. In the VS Code terminal, navigate to a directory where you want to store your project.

1. In the terminal, use the `dotnet new` command to create a new console app. This command creates a simple "Hello World" C# project with a single source file: Program.cs.

Expand All @@ -71,7 +75,7 @@ In this section we'll create project named az204-blob and install the Azure Blob
dotnet build
```

1. Inside the _az204-blob_ folder, create another folder named _data_. This is where the blob data files will be created and stored.
1. Inside the _az204-blob_ folder, create another folder named _data_. This is where the blob data files are created and stored.

```sh
mkdir data
Expand Down Expand Up @@ -116,13 +120,13 @@ In this section we'll create project named az204-blob and install the Azure Blob

## Build the full app

For each of the following sections below you'll find a brief description of the action being taken as well as the code snippet you'll add to the project. Each new snippet is appended to the one before it, and we'll build and run the console app at the end.
Now it's time to build the app. The following sections contain a brief description of the action being taken as well, as the code snippet you add to the project. Each new snippet is appended to the one before it. You build and run the console app at the end.

For each example below copy the code and append it to the previous snippet in the example code section of the _Program.cs_ file.
For each of the following examples, copy the code and append it to the previous snippet in the example code section of the _Program.cs_ file.

### Create a container

To create the container first create an instance of the `BlobServiceClient` class, then call the `CreateBlobContainerAsync` method to create the container in your storage account. A GUID value is appended to the container name to ensure that it is unique. The `CreateBlobContainerAsync` method will fail if the container already exists.
Creating a container includes creating an instance of the `BlobServiceClient` class, and then calling the `CreateBlobContainerAsync` method to create the container in your storage account. A GUID value is appended to the container name to ensure that it's unique. The `CreateBlobContainerAsync` method fails if the container already exists.

```csharp
//Create a unique name for the container
Expand Down Expand Up @@ -170,7 +174,7 @@ Console.ReadLine();

### List the blobs in a container

List the blobs in the container by using the `GetBlobsAsync` method. In this case, only one blob has been added to the container, so the listing operation returns just that one blob.
List the blobs in the container by using the `GetBlobsAsync` method. In this case, only one blob was added to the container, so the listing operation returns just that one blob.

```csharp
// List blobs in the container
Expand Down Expand Up @@ -240,7 +244,7 @@ There are many prompts in the app to allow you to take the time to see what's ha

## Clean up other resources

The app deleted the resources it created. You can delete all of the resources created for this exercise by using the command below. You will need to confirm that you want to delete the resources.
The app deleted the resources it created. You can delete all of the resources created for this exercise by using the following command. You need to confirm that you want to delete the resources.

```sh
az group delete --name az204-blob-rg --no-wait
Expand Down
14 changes: 8 additions & 6 deletions Exercises/Create a backend API/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ This section shows how to import and publish an OpenAPI specification backend AP

1. On the **API Management** screen, select the API Management instance you created.

1. Select **APIs** in the **API management service** navigation pane.
1. In the **API management service** navigation pane, under **APIs**, select **APIs**.

![Select APIs in the service navigation pane.](https://learn.microsoft.com/en-us/training/wwl-azure/explore-api-management/media/select-apis-navigation-pane.png)

Expand All @@ -77,11 +77,13 @@ This section shows how to import and publish an OpenAPI specification backend AP
| Description | Automatically populated | Provide an optional description of the API. |
| API URL suffix | _conference_ | The suffix is appended to the base URL for the API management service. API Management distinguishes APIs by their suffix and therefore the suffix must be unique for every API for a given publisher. |

## Configure the backend settings
## Configure the API settings

The `Demo Conference API` is created and a backend needs to be specified.
The _Demo Conference API_ is created. Configure the API settings.

1. Select **Settings** in the blade to the right and enter `https://conferenceapi.azurewebsites.net/` in the **Web service URL** field.
1. Select **Settings** in the blade to the right.

1. Confirm that `https://conferenceapi.azurewebsites.net/` is in the **Web service URL** field.

1. Deselect the **Subscription required** checkbox.

Expand All @@ -91,13 +93,13 @@ The `Demo Conference API` is created and a backend needs to be specified.

## Test the API

Now that the API has been imported and the backend configured it's time to test the API.
Now that the API has been imported and configured it's time to test the API.

1. Select **Test**.

![Select test in the right pane.](https://learn.microsoft.com/en-us/training/wwl-azure/explore-api-management/media/select-test.png)

1. Select **GetSpeakers**. The page shows **Query parameters** and **Headers**, if any. The `Ocp-Apim-Subscription-Key` is filled in automatically for the subscription key associated with this API.
1. Select **GetSpeakers**. The page shows **Query parameters** and **Headers**, if any.

1. Select **Send**.

Expand Down
Loading

0 comments on commit a52780a

Please sign in to comment.