# AzureSandboxGroupResource Methods

- Package: [Aspire.Hosting.Azure.Sandboxes](/reference/api/csharp/aspire.hosting.azure.sandboxes.md)
- Type: [AzureSandboxGroupResource](/reference/api/csharp/aspire.hosting.azure.sandboxes/azuresandboxgroupresource.md)
- Kind: `Methods`
- Members: `3`

Represents an Azure Container Apps sandbox group.

<a id="addasexistingresource"></a>
<a id="addasexistingresource-azureresourceinfrastructure"></a>

## AddAsExistingResource(AzureResourceInfrastructure)

- Name: `AddAsExistingResource(AzureResourceInfrastructure)`
- Modifiers: `override`
- Returns: `ProvisionableResource`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs#L319-L337)

Adds a new `Primitives.ProvisionableResource` into `infra`. The new resource represents a reference to the current `Azure.AzureProvisioningResource` via https://learn.microsoft.com/azure/azure-resource-manager/bicep/existing-resource.

```csharp
public sealed class AzureSandboxGroupResource
{
    public override ProvisionableResource AddAsExistingResource(
        AzureResourceInfrastructure infra)
    {
        // ...
    }
}
```

## Parameters

- `infra` (`AzureResourceInfrastructure`)
  The `Azure.AzureResourceInfrastructure` to add the existing resource into.

## Returns

`ProvisionableResource` -- A new `Primitives.ProvisionableResource`, typically using the FromExisting method on the derived `Primitives.ProvisionableResource` class.

<a id="getendpointpropertyexpression"></a>
<a id="getendpointpropertyexpression-endpointreferenceexpression"></a>

## GetEndpointPropertyExpression(EndpointReferenceExpression)

> **Experimental:** ASPIRECOMPUTE002 - [Learn more](/diagnostics/aspirecompute002/)

- Name: `GetEndpointPropertyExpression(EndpointReferenceExpression)`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs#L302-L313)

Gets a `ApplicationModel.ReferenceExpression` representing a deployed endpoint property for the specified `ApplicationModel.EndpointReferenceExpression`.

```csharp
public sealed class AzureSandboxGroupResource
{
    public ReferenceExpression GetEndpointPropertyExpression(
        EndpointReferenceExpression endpointReferenceExpression)
    {
        // ...
    }
}
```

## Parameters

- `endpointReferenceExpression` (`EndpointReferenceExpression`)
  The endpoint reference expression for which to retrieve a deployed endpoint property.

## Returns

`ReferenceExpression` -- A `ApplicationModel.ReferenceExpression` representing the deployed endpoint property.

## Exceptions

- `ArgumentNullException` -- Thrown when `endpointReferenceExpression` is `null`.
- `InvalidOperationException` -- Thrown when the requested endpoint property is unsupported, or when a non-HTTP/HTTPS endpoint does not specify a port.

## Remarks

Use this method when an endpoint property should be represented as a compute-environment-specific `ApplicationModel.ReferenceExpression` instead of being resolved from a local endpoint allocation. The default implementation composes values from `IComputeEnvironmentResource.GetHostAddressExpression`, the endpoint scheme, and endpoint ports. HTTP and HTTPS endpoints use ports 80 and 443 respectively when no explicit port is configured.

<a id="gethostaddressexpression"></a>
<a id="gethostaddressexpression-endpointreference"></a>

## GetHostAddressExpression(EndpointReference)

> **Experimental:** ASPIRECOMPUTE002 - [Learn more](/diagnostics/aspirecompute002/)

- Name: `GetHostAddressExpression(EndpointReference)`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/f4c27f2d43ddc1cacd0dd083b30d1fea1cee7a62/src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxGroupResource.cs#L293-L295)

Gets a `ApplicationModel.ReferenceExpression` representing the host address or host name for the specified `ApplicationModel.EndpointReference`.

```csharp
public sealed class AzureSandboxGroupResource
{
    public ReferenceExpression GetHostAddressExpression(
        EndpointReference endpointReference)
    {
        // ...
    }
}
```

## Parameters

- `endpointReference` (`EndpointReference`)
  The endpoint reference for which to retrieve the host address or host name.

## Returns

`ReferenceExpression` -- A `ApplicationModel.ReferenceExpression` representing the host address or host name (not a full URL).

## Remarks

The returned value typically contains only the host name or address, without scheme, port, or path information.
