# RunAsExistingInResourceGroup

- Module: [Aspire.Hosting.Azure](/reference/api/go/aspire.hosting.azure.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`AzureResource`](/reference/api/go/aspire.hosting.azure/azureresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

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
```

## 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()`.

## 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)
