Skip to content

Commit 8f86c0c

Browse files
README.MD bug fixes (#47041)
* README.MD bug fixes * Update sdk/cloudmachine/README.MD Co-authored-by: Christopher Scott <[email protected]> * Update sdk/cloudmachine/README.MD Co-authored-by: Christopher Scott <[email protected]> --------- Co-authored-by: Christopher Scott <[email protected]>
1 parent 1d69620 commit 8f86c0c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

sdk/cloudmachine/README.MD

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Write Azure apps in 5 minutes
66

77
### Prerequisites
88

9-
> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/).
10-
> You must have .NET 8 (or higher) installed
11-
> You must have Azure CLI installed
12-
> You must have Azure Developer CLI installed
13-
> You must have npm installed
14-
> You must be logged into Azure CLI and Azure Developer CLI
9+
* You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/).
10+
* You must have .NET 8 (or higher) installed
11+
* You must have Azure CLI (az) installed
12+
* You must have Azure Developer CLI (azd) installed
13+
* You must have npm installed
14+
* You must be logged into Azure CLI and Azure Developer CLI
1515

1616
### Walkthrough
1717

@@ -30,19 +30,19 @@ Add `Azure.CloudMachine.All` package
3030
```dotnetcli
3131
dotnet add package Azure.CloudMachine.All --prerelease
3232
```
33-
#### Use Azure Dev CLI to provision CloudMachine
33+
#### Use Azure Developer CLI to provision CloudMachine
3434

35-
Open Program.cs file and add the following two lines of code to the top of the file
35+
Open `Program.cs` file and add the following two lines of code to the top of the file
3636
```csharp
37-
using Azure.Provisioning.CloudMachine;
37+
using Azure.CloudMachine;
3838

3939
if (CloudMachineInfrastructure.Configure(args)) return;
4040
```
41-
The `CloudMachineInfrastructure.Configure` call allows running the app with `-bicep` switch, which generate bicep files required to provision resources in Azure. Let's generate these bicep files now.
41+
The `CloudMachineInfrastructure.Configure` call allows running the app with a `-bicep` switch, which will generate bicep files required to provision CloudMachine resources in Azure. Let's generate these bicep files now.
4242
```dotnetcli
4343
dotnet run -bicep
4444
```
45-
As you can see, a folder called `infra` was created and it should have several bicep files in it. Let's now initialize the project for azd.
45+
As you can see, a folder called `infra` was created with several bicep files in it. Let's now initialize the project.
4646
```dotnetcli
4747
azd init
4848
```
@@ -56,26 +56,26 @@ When provisioning finishes, you should see something like the following in the c
5656
```dotnetcli
5757
(✓) Done: Resource group: cm125957681369428 (627ms)
5858
```
59-
And if you go to your Azure portal, or execute the following az cli command to see the resource group created. The resource group will have server resources such us Storage, ServiceBus, and EventGrid.
59+
And if you go to your Azure portal, or execute the following az command, you can see the resource group created. The resource group will contain resources such as Storage, ServiceBus, and EventGrid.
6060
```dotnetcli
6161
az resource list --resource-group <resource_group_from_command_line> --output table
6262
```
6363

6464
#### Use CDK to add resources to the CloudMachine
6565

66-
Since we are writing an AI application, we need to provision Azure OpenAI resources. To do this, add the follwoing class to the end of the Program.cs file:
66+
Since we are writing an AI application, we need to provision Azure OpenAI resources. To do this, add the follwoing class to the end of the `Program.cs` file:
6767
```csharp
6868
class AssistantService {
6969
internal static void Configure(CloudMachineInfrastructure cm) {
7070
cm.AddFeature(new OpenAIFeature() { Chat = new AIModel("gpt-4o-mini", "2024-07-18") });
7171
}
7272
}
7373
```
74-
And change the infrastructure configuration call att he begining of the file to:
74+
Then change the configuration call at the beginning of the file to:
7575
```csharp
7676
if (CloudMachineInfrastructure.Configure(args, AssistantService.Configure)) return;
7777
```
78-
And now regenerate new bicep with the new Azure OpenAI resources, and re-provision
78+
Now regenerate the bicep files and re-provision
7979
```dotnetcli
8080
dotnet run -bicep
8181
azd provision
@@ -95,12 +95,12 @@ class AssistantService {
9595
}
9696
}
9797
```
98-
Lastly, create an instance of the service and call the `Chat` method when the app users browses the app:
98+
Lastly, create an instance of the service and call the `Chat` method when the user navigates to the root URL:
9999
```csharp
100100
var service = new AssistantService();
101101
app.MapGet("/", async () => await service.Chat("List all noble gases"));
102102
```
103-
The full program should look like following:
103+
The full program should now look like the following:
104104
```csharp
105105
using Azure.CloudMachine;
106106
using Azure.CloudMachine.OpenAI;
@@ -136,28 +136,28 @@ You can now start the application
136136
```dotnetcli
137137
dotnet run
138138
```
139-
and browse to the URI printed in the console.
139+
and navigate to the URL printed in the console.
140140

141141
#### Use TDK to expose Web APIs and generate TypeSpec
142-
First, let's define an API we want to expose. We will do it using an interface. Add the following interface to the end of Program.cs:
142+
First, let's define an API we want to expose. We will do it using a C# interface. Add the following interface to the end of `Program.cs`:
143143
```csharp
144144
interface IAssistantService {
145145
Task<string> Chat(string message);
146146
}
147147
```
148-
Make sure that the `AssistantService` implements the interface:
148+
Make sure that the `AssistantService` class implements the interface:
149149
```csharp
150150
class AssistantService : IAssistantService
151151
```
152-
Expose the service methods as web APIs by adding the following line after the existing 'var service = new AssistantService();' line:
152+
Expose the service methods as web APIs by adding the following line after the existing `var service = new AssistantService();` line:
153153
```csharp
154154
app.Map(service);
155155
```
156-
Lastly, add the ability to generate TypeSpec for the new API by adding new statement to the `Configure` method
156+
Lastly, add the ability to generate TypeSpec for the new API by adding a new statement to the `Configure` method
157157
```csharp
158158
cm.AddEndpoints<IAssistantService>();
159159
```
160-
Your program shoud now look like following:
160+
Your program shoud now look like the following:
161161
```csharp
162162
using Azure.CloudMachine;
163163
using Azure.CloudMachine.OpenAI;
@@ -195,13 +195,13 @@ interface IAssistantService {
195195
Task<string> Chat(string message);
196196
}
197197
```
198-
You can now start the application and browse to the /chat endpoint [TDB]
198+
You can now start the application and browse to the /chat endpoint [TBD on how to pass the parameter]
199199

200200
But what's more interesting, you can run the app with the -tsp switch to generate TypeSpec for the endpoint:
201201
```dotnetcli
202202
dotnet run -tsp
203203
```
204-
This will create a `tsp` directory, AssistantService.tsp file, with the following contents:
204+
This will create a `tsp` directory, `AssistantService.tsp` file, with the following contents:
205205
```tsp
206206
import "@typespec/http";
207207
import "@typespec/rest";
@@ -245,7 +245,7 @@ cd cmdclient
245245
dotnet new console
246246
dotnet add reference ..\tsp-output\@typespec\http-client-csharp\src\AssistantService.csproj
247247
```
248-
And change the Program.cs file to the following, replacing the client URI with the URI in your server's launchsettings.json file ('cmdemo\server\Properties' folder)
248+
And change the `Program.cs` file to the following, replacing the client URI with the URI in your server's launchsettings.json file ('cmdemo\server\Properties' folder)
249249

250250
```csharp
251251
using AssistantService;

0 commit comments

Comments
 (0)