# EntraIdApplicationResource Methods

- Package: [Aspire.Hosting.Azure.EntraId](/reference/api/csharp/aspire.hosting.azure.entraid.md)
- Type: [EntraIdApplicationResource](/reference/api/csharp/aspire.hosting.azure.entraid/entraidapplicationresource.md)
- Kind: `Methods`
- Members: `3`

A resource that represents a Microsoft Entra ID application registration.

<a id="getbiceptemplatefile"></a>
<a id="getbiceptemplatefile-string-bool"></a>

## GetBicepTemplateFile(string?, bool)

- Name: `GetBicepTemplateFile(string?, bool)`
- Modifiers: `override`
- Returns: `BicepTemplateFile`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs#L238-L239)

Gets the path to the bicep file. If the template is a string or embedded resource, it will be written to a temporary file.

```csharp
public class EntraIdApplicationResource
{
    public override BicepTemplateFile GetBicepTemplateFile(
        string? directory = null,
        bool deleteTemporaryFileOnDispose = true)
    {
        // ...
    }
}
```

## Parameters

- `directory` (`string?`) `optional`
  The directory where the bicep file will be written to (if it's a temporary file)
- `deleteTemporaryFileOnDispose` (`bool`) `optional`
  A boolean that determines if the file should be deleted on disposal of the `Azure.BicepTemplateFile`.

## Returns

`BicepTemplateFile` -- A `Azure.BicepTemplateFile` that represents the bicep file.

## Exceptions

- `InvalidOperationException`

<a id="getbiceptemplatestring"></a>

## GetBicepTemplateString

- Name: `GetBicepTemplateString`
- Modifiers: `override`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs#L231-L233)

Get the bicep template as a string. Does not write to disk.

```csharp
public class EntraIdApplicationResource
{
    public override string GetBicepTemplateString()
    {
        // ...
    }
}
```

<a id="getscopeuri"></a>
<a id="getscopeuri-string"></a>

## GetScopeUri(string)

- Name: `GetScopeUri(string)`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/2d325b13709752ba6d9a943635c5e2940a2530c0/src/Aspire.Hosting.Azure.EntraId/EntraIdApplicationResource.cs#L996-L1003)

Gets an expression for the full URI of one of this registration's scopes, such as `api://{clientId}/access_as_user`.

```csharp
public class EntraIdApplicationResource
{
    public ReferenceExpression GetScopeUri(
        string scopeName)
    {
        // ...
    }
}
```

## Parameters

- `scopeName` (`string`)
  The name of a scope added with `WithScope`.

## Returns

`ReferenceExpression` -- An expression that resolves when the registration's application ID URI is known.

## Exceptions

- `ArgumentException` -- The registration does not expose a scope with that name.
- `InvalidOperationException` -- The registration is an existing registration without an application ID URI.

## Remarks

Clients request the full URI as the token scope, for example in Microsoft.Identity.Web's `DownstreamApis` configuration.
