# AzureResource.RunAsExistingInResourceGroup

- Module: [Aspire.Hosting.Azure](/reference/api/go/aspire.hosting.azure.md)
- Defined on: [AzureResource](/reference/api/go/aspire.hosting.azure/azureresource.md)
- Version: `17.0.0`
- Kind: `method`

Marks the resource as an existing resource in a specific resource group and subscription when the application is running.

## Definition

```go
func (AzureResource) RunAsExistingInResourceGroup(
    name any,
    resourceGroup any,
    subscription any,
) AzureResource
```

## Signature

```go
RunAsExistingInResourceGroup(
    name any,
    resourceGroup any,
    subscription any,
) AzureResource
```

## Parameters

- `name` (`any`) -- The name of the existing resource as a string or parameter resource.
- `resourceGroup` (`any`) -- The resource group containing the existing resource as a string or parameter resource.
- `subscription` (`any`) -- The subscription identifier containing the resource group as a string or parameter resource.

## Returns

[`AzureResource`](/reference/api/go/aspire.hosting.azure/azureresource.md) -- The resource builder with the existing resource annotation added.

Returns a handle; failures surface later via `Err()`.

## Defined on

A marker interface declares no methods of its own in Go. Its functions are declared on the concrete types they apply to.

- [AzureResource](/reference/api/go/aspire.hosting.azure/azureresource.md) -- `marker`

## Applies to

- [`AzureBicepResource`](/reference/api/go/aspire.hosting.azure/azurebicepresource.md)
- [`AzureProvisioningResource`](/reference/api/go/aspire.hosting.azure/azureprovisioningresource.md)
- [`AzureUserAssignedIdentityResource`](/reference/api/go/aspire.hosting.azure/azureuserassignedidentityresource.md)
