> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enclave.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Enclave in these docs is the code and cloud security platform at enclave.ai. It is not Open Enclave, Intel SGX or other hardware enclaves, or enclave.gg.
> People use Enclave in the web app at https://app.enclave.ai or the desktop app. These docs describe no public Enclave API or CLI, so don't invent endpoints, commands, or config files.
> Connecting an integration needs a person to sign in and approve access in a browser. Tell the user the exact step to take instead of saying you completed it.

# Azure

> 通过管理员同意和只读 Reader 角色连接你的 Azure 租户，无需存储任何密钥。

连接你的 Azure 租户，让 Enclave 可以梳理每个订阅中的资源和身份，并将它们与你的代码关联起来。访问是只读的，且无需存储任何密钥。

## Enclave 需要什么

Enclave 通过其拥有的一个多租户 Microsoft Entra 应用进行连接。你需要授予它两项内容：

* 对 Enclave 应用的**管理员同意**。这包括 Microsoft Graph 的 `Directory.Read.All` 权限，Enclave 用它读取 Entra 身份，例如服务主体、应用和组。
* **租户根管理组**上的 **Reader** 角色。根级别的 Reader 会被租户中的每个订阅继承，包括你之后创建的订阅。

### 谁可以运行设置

* 如需授予管理员同意，你需要一个可以代表整个组织授予同意的 Entra 角色。
* 如需运行 Cloud Shell 命令，你需要拥有在租户根管理组上创建角色分配的权限。
* 在 Enclave 中，你需要 **Owner** 或 **Admin** 角色。

## 连接你的租户

**1. 打开设置页面**

打开 **Settings → Integrations**，点击 **Microsoft Azure** 旁边的 **Connect**。

**2. 授予管理员同意**

在 **Connect Microsoft** 下，点击 **Connect Microsoft**。以 Entra 管理员身份登录，并为你的组织批准 Enclave 应用。Enclave 会等待同意完成，然后显示下一步。

**3. 授予租户根级别的 Reader 角色**

在 **Grant tenant-root Reader** 下，复制命令。打开 [Azure Cloud Shell](https://shell.azure.com) 并运行它。该命令如下所示：

```bash theme={null}
az role assignment create --assignee <enclave-app-id> --role Reader --scope /providers/Microsoft.Management/managementGroups/<tenant-id>
```

**4. 验证**

回到 Enclave，点击 **Validate**。Enclave 会检查它能否列出你租户的订阅。

验证完成后，Enclave 会在下一次扫描时发现你的订阅。之后，每个订阅都会在连接中显示为单独的条目。

## Enclave 会发现什么

* **基础设施**：每个订阅中的每个资源，通过 Azure Resource Graph 读取。
* **网络拓扑**：子网、路由和防火墙规则。
* **身份**：角色分配和定义、托管标识，以及 Entra 服务主体、应用和组。Enclave 会将虚拟机和其他计算资源与其运行时使用的托管标识关联起来。

## 管理连接

打开 **Settings → Integrations → Microsoft Azure**，查看已连接的订阅。

* **Re-validate** 会检查 Enclave 是否仍能读取某个订阅。
* **Remove** 会停止扫描某个订阅。
* **Disconnect Azure** 会移除整个连接并停止扫描。

如需从 Azure 撤销访问权限，请在 Entra 中移除对 Enclave 应用的同意，并删除其在租户根级别的 Reader 角色分配。

## Enclave 会做什么、不会做什么

* **会**：使用 Reader 角色和 `Directory.Read.All` 读取资源配置和身份。
* **不会**：创建、更改或删除资源，或读取你的文件、密钥、消息或数据库的内容。Enclave 不会为你的租户存储凭证。每次扫描都使用短期令牌。

## 故障排除

> [accordion] 验证失败
>
> Reader 角色分配缺失或尚未生效。再次运行 Cloud Shell 命令，等待一分钟，然后点击 **Revalidate**。

> [accordion] 连接中没有显示任何订阅
>
> 如果连接显示 **Tenant validated. Subscriptions are discovered on the next scan.**，说明 Enclave 还未扫描。如需立即扫描，请在 [Coverage](https://docs.enclave.ai/zh/onboarding/coverage.md) 中点击 **Analyze Environment**。

> [accordion] 资源出现了，但 Entra 身份没有出现
>
> 身份发现需要 `Directory.Read.All` 同意，这与 Reader 角色是分开的。请再次向 Enclave 应用授予管理员同意。

> [accordion] 页面提示管理员同意不可用
>
> 只有所有者和管理员可以开始 Azure 设置。如果你拥有正确的角色但仍看到此提示，请联系支持团队。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.