# IResourceWithEnvironment.withEnvironmentCallback

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Defined on: [IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md)
- Version: `13.4.0`
- Kind: `method`

Allows for the population of environment variables on a resource.

## Definition

```typescript
interface IResourceWithEnvironment {
  // ... omitted for brevity
  withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise<void>): IResourceWithEnvironment;
}
```

## Signature

```typescript
withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise<void>): IResourceWithEnvironment
```

## Parameters

- `callback` (`(arg: EnvironmentCallbackContext) => Promise<void>`)

## Returns

[IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md) `builder`

## Defined on

- [IResourceWithEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment.md) -- `interface`
