Skip to content

Commit

Permalink
Fixing updated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Nov 4, 2024
1 parent ab59e2d commit b0efa01
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 68 deletions.
13 changes: 8 additions & 5 deletions docs/caching/caching-integrations-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,22 @@ Replace the contents of the _:::no-loc text="Program.cs":::_ file in the _Aspire
```csharp
var builder = DistributedApplication.CreateBuilder(args);

var cache = builder.AddRedis("cache")
.PublishAsAzureRedis();
var cache = builder.AddAzureRedis("cache");

var apiService = builder.AddProject<Projects.AspireRedis_ApiService>("apiservice")
.WithReference(cache);

builder.AddProject<Projects.AspireRedis_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(cache)
.WithReference(apiService);
.WaitFor(cache)
.WithReference(apiService)
.WaitFor(apiService);

builder.Build().Run();
```

The preceding code adds an Azure Cache for Redis resource to your app and configures a connection called `cache`. The `PublishAsAzureRedis` method ensures that tools such as the Azure Developer CLI or Visual Studio create an Azure Cache for Redis resource during the deployment process.
The preceding code adds an Azure Cache for Redis resource to your app and configures a connection called `cache`. The `AddAzureRedis` method ensures that tools such as the Azure Developer CLI or Visual Studio create an Azure Cache for Redis resource during the deployment process.

## [Redis Container](#tab/redis-container)

Expand All @@ -94,7 +95,9 @@ var apiService = builder.AddProject<Projects.RedisSample_ApiService>("apiservice
builder.AddProject<Projects.RedisSample_Web>("webfrontend")
.WithExternalHttpEndpoints()
.WithReference(cache)
.WithReference(apiService);
.WaitFor(cache)
.WithReference(apiService)
.WaitFor(apiService);

builder.Build().Run();
```
Expand Down
91 changes: 28 additions & 63 deletions docs/deployment/manifest-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,12 @@ The following resources are available in the [Aspire.Hosting.Azure](https://www.
|--|--|--|
| <xref:Aspire.Hosting.AzureAppConfigurationExtensions.AddAzureAppConfiguration%2A> | `azure.bicep.v0` | [Azure App Configuration resource types](#azure-app-configuration-resource-type) |
| <xref:Aspire.Hosting.AzureKeyVaultResourceExtensions.AddAzureKeyVault%2A> | `azure.bicep.v0` | [Azure Key Vault resource type](#azure-key-vault-resource-type) |
| <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis%2A>`.AsAzureRedis()` | `azure.bicep.v0` | [Azure Redis resource types](#azure-redis-resource-type) |
| `AddAzureRedis` | `azure.bicep.v0` | [Azure Redis resource types](#azure-redis-resource-type) |
| <xref:Aspire.Hosting.AzureServiceBusExtensions.AddAzureServiceBus%2A> | `azure.bicep.v0` | [Azure Service Bus resource type](#azure-service-bus-resource-type) |
| <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer%2A>`.AsAzureSqlDatabase()` | `azure.bicep.v0` | [Azure SQL resource types](#azure-sql-resource-types) |
| <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer%2A>`.AsAzureSqlDatabase().AddDatabase(...)` | `value.v0` | [Azure SQL resource types](#azure-sql-resource-types) |
| <xref:Aspire.Hosting.PostgresBuilderExtensions.AddPostgres%2A>`.AsAzurePostgresFlexibleServer(...)` | `azure.bicep.v0` | [Azure Postgres resource types](#azure-postgres-resource-types) |
| <xref:Aspire.Hosting.PostgresBuilderExtensions.AddPostgres%2A>`.AsAzurePostgresFlexibleServer(...).AddDatabase(...)` | `value.v0` | [Azure Postgres resource types](#azure-postgres-resource-types) |
| `AddAzureSqlServer(...)` | `azure.bicep.v0` | [Azure SQL resource types](#azure-sql-resource-types) |
| `AddAzureSqlServer(...).AddDatabase(...)` | `value.v0` | [Azure SQL resource types](#azure-sql-resource-types) |
| `AddAzurePostgresFlexibleServer(...)` | `azure.bicep.v0` | [Azure Postgres resource types](#azure-postgres-resource-types) |
| `AddAzurePostgresFlexibleServer(...).AddDatabase(...)` | `value.v0` | [Azure Postgres resource types](#azure-postgres-resource-types) |
| <xref:Aspire.Hosting.AzureStorageExtensions.AddAzureStorage%2A> | `azure.storage.v0` | [Azure Storage resource types](#azure-storage-resource-types) |
| <xref:Aspire.Hosting.AzureStorageExtensions.AddBlobs%2A> | `value.v0` | [Azure Storage resource types](#azure-storage-resource-types) |
| <xref:Aspire.Hosting.AzureStorageExtensions.AddQueues%2A> | `value.v0` | [Azure Storage resource types](#azure-storage-resource-types) |
Expand Down Expand Up @@ -779,22 +779,21 @@ Example code:
```csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddRedis("azredis1")
.PublishAsAzureRedis();
builder.AddAzureRedis("azredis1");
```

Example manifest:

```json
{
"resources": {
"azredis1": {
"azredis": {
"type": "azure.bicep.v0",
"connectionString": "{azredis1.secretOutputs.connectionString}",
"path": "aspire.hosting.azure.bicep.redis.bicep",
"connectionString": "{azredis.outputs.connectionString}",
"path": "azredis.module.bicep",
"params": {
"redisCacheName": "azredis1",
"keyVaultName": ""
"principalId": "",
"principalName": ""
}
}
}
Expand Down Expand Up @@ -837,8 +836,7 @@ Example code:
```csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddSqlServer("sql1")
.PublishAsAzureSqlDatabase()
builder.AddAzureSqlServer("sql")
.AddDatabase("inventory");
```

Expand All @@ -847,22 +845,18 @@ Example manifest:
```json
{
"resources": {
"sql1": {
"sql": {
"type": "azure.bicep.v0",
"connectionString": "Server=tcp:{sql1.outputs.sqlServerFqdn},1433;Encrypt=True;Authentication=\u0022Active Directory Default\u0022",
"path": "aspire.hosting.azure.bicep.sql.bicep",
"connectionString": "Server=tcp:{sql.outputs.sqlServerFqdn},1433;Encrypt=True;Authentication=\u0022Active Directory Default\u0022",
"path": "sql.module.bicep",
"params": {
"serverName": "sql1",
"principalId": "",
"principalName": "",
"databases": [
"inventory"
]
"principalName": ""
}
},
"inventory": {
"type": "value.v0",
"connectionString": "{sql1.connectionString};Database=inventory"
"connectionString": "{sql.connectionString};Database=inventory"
}
}
}
Expand All @@ -875,52 +869,23 @@ Example code:
```csharp
var builder = DistributedApplication.CreateBuilder(args);

var administratorLogin = builder.AddParameter("administratorLogin");
var administratorLoginPassword = builder.AddParameter(
"administratorLoginPassword", secret: true);

var pg = builder.AddPostgres("postgres")
.PublishAsAzurePostgresFlexibleServer(
administratorLogin, administratorLoginPassword)
.AddDatabase("db");
builder.AddAzurePostgresFlexibleServer("postgres")
.AddDatabase("db");
```

Example manifest:

```json
{
"resources": {
"administratorLogin": {
"type": "parameter.v0",
"value": "{administratorLogin.inputs.value}",
"inputs": {
"value": {
"type": "string"
}
}
},
"administratorLoginPassword": {
"type": "parameter.v0",
"value": "{administratorLoginPassword.inputs.value}",
"inputs": {
"value": {
"type": "string",
"secret": true
}
}
},
"postgres": {
"type": "azure.bicep.v0",
"connectionString": "{postgres.secretOutputs.connectionString}",
"path": "aspire.hosting.azure.bicep.postgres.bicep",
"connectionString": "{postgres.outputs.connectionString}",
"path": "postgres.module.bicep",
"params": {
"serverName": "postgres",
"keyVaultName": "",
"administratorLogin": "{administratorLogin.value}",
"administratorLoginPassword": "{administratorLoginPassword.value}",
"databases": [
"db"
]
"principalId": "",
"principalType": "",
"principalName": ""
}
},
"db": {
Expand All @@ -935,11 +900,11 @@ Example manifest:

The [Azure Developer CLI](/azure/developer/azure-developer-cli/) (azd) is a tool that can be used to deploy .NET Aspire projects to Azure Container Apps. With the `azure.bicep.v0` resource type, cloud-agnostic resource container types can be mapped to Azure-specific resources. The following table lists the resource types that are supported in the Azure Developer CLI:

| Name | Cloud-agnostic API | Configure as Azure resource |
| Name | Cloud-agnostic API | Azure API |
| ---- | ---------------------------- | ---------------------------------- |
| Redis | <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis%2A> | `PublishAsAzureRedis` |
| Postgres | <xref:Aspire.Hosting.PostgresBuilderExtensions.AddPostgres%2A> | `PublishAsAzurePostgresFlexibleServer` |
| SQL Server | <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer%2A> | `PublishAsAzureSqlDatabase` |
| Redis | <xref:Aspire.Hosting.RedisBuilderExtensions.AddRedis%2A> | `AddAzureRedis` |
| Postgres | <xref:Aspire.Hosting.PostgresBuilderExtensions.AddPostgres%2A> | `AddAzurePostgresFlexibleServer` |
| SQL Server | <xref:Aspire.Hosting.SqlServerBuilderExtensions.AddSqlServer%2A> | `AddAzureSqlServer` |

When resources as configured as Azure resources, the `azure.bicep.v0` resource type is generated in the manifest. For more information, see [Deploy a .NET Aspire project to Azure Container Apps using the Azure Developer CLI (in-depth guide)](azure/aca-deployment-azd-in-depth.md).

Expand Down

0 comments on commit b0efa01

Please sign in to comment.