---
title: Private Links
description: Adding Private Link operations to ARM resources
llmstxt: true
---

import { ExampleRef } from "@components/sample";

Private Link resources allow users to discover which connection types are available for a resource.
Resource providers that support private link resources must declare a private link resource type in
their provider namespace and use the standard `PrivateLinks` interface to expose operations.

## Defining a Private Link Resource

To define a private link resource, create a model in your provider namespace that extends
`PrivateLink`:

```typespec
model MyPrivateLinkResource is PrivateLink;
```

## Defining Private Link Operations

Create an alias for your private link operations using the `PrivateLinks` interface template:

```typespec
alias PrivateLinkOps = PrivateLinks<MyPrivateLinkResource>;
```

## Adding Private Link Operations to Your Resource Interface

Add private link operations to your resource interface using the operations alias:

```typespec
@armResourceOperations
interface Employees {
  // ... other resource operations ...
  getPrivateLink is PrivateLinkOps.Read<Employee>;
  listPrivateLinks is PrivateLinkOps.ListByParent<Employee>;
}
```

## Available Operations

The `PrivateLinks` interface provides the following operations:

| Operation    | Description                              | TypeSpec Representation                          |
| ------------ | ---------------------------------------- | ------------------------------------------------ |
| Read         | Get a single private link resource       | `getPrivateLink is Ops.Read<ParentResource>;`    |
| ListByParent | List private link resources for a parent | `listLinks is Ops.ListByParent<ParentResource>;` |

## Complete Example

The following example shows a complete service with private link support:

<ExampleRef path="resource-manager/resource-types/private-links" />

## Using Private Links with Child Resources

Private link operations can also be used with child resources. You can reuse the same operations
alias across multiple resource interfaces:

```typespec
@parentResource(Employee)
model Dependent is ProxyResource<DependentProperties> {
  ...ResourceNameParameter<Dependent>;
}

@armResourceOperations
interface Dependents {
  get is ArmResourceRead<Dependent>;
  createOrUpdate is ArmResourceCreateOrReplaceAsync<Dependent>;
  delete is ArmResourceDeleteSync<Dependent>;
  list is ArmResourceListByParent<Dependent>;

  // Reuse the same private link operations alias
  getPrivateLink is PrivateLinkOps.Read<Dependent>;
  listPrivateLinks is PrivateLinkOps.ListByParent<Dependent>;
}
```
