Communitygithub.com

使用SAML与Azure AD构建身份联合

配置本地Active Directory(通过AD FS或第三方IdP)与Microsoft Entra ID之间的SAML 2.0身份联合,涵盖联合模型(AD FS、密码哈希同步、直通身份验证、第三方IdP)和SAML身份验证流程。适用于将本地身份验证权限扩展到云资源,或为Entra ID设计混合身份SSO架构。

使用SAML与Azure AD构建身份联合 是什么?

该技能详细指导开发者或IT管理员在本地Active Directory与Microsoft Entra ID之间建立基于SAML 2.0的身份联合。它支持多种联合模型:联合(AD FS)、托管(密码哈希同步或直通身份验证)以及第三方IdP(如Okta、Ping),并提供了完整的PowerShell脚本示例和配置步骤。通过将身份验证权限保留在本地,同时为云资源(如Office 365、SaaS应用)实现单点登录,该方案有效消除了密码同步的顾虑,满足了合规性要求。技能涵盖了AD FS基础设施准备、Azure AD联合域配置、声明规则设置、第三方SaaS联盟集成以及证书生命周期管理,并提供了验证清单和故障恢复指南。主要适用于运行Windows Server和Azure环境的企业,旨在帮助构建安全、合规的混合身份架构。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/building-identity-federation-with-saml-azure-ad

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

使用SAML与Azure AD构建身份联合 是做什么的?

概述

身份联合允许由一个身份提供者验证的用户访问另一个提供者管理的资源,而无需维护单独的凭据。本技能涵盖在组织的本地Active Directory(通过AD FS或第三方IdP)与Microsoft Entra ID(原Azure AD)之间建立SAML 2.0联合,以及为第三方SaaS应用配置联合SSO。联合消除了密码同步的顾虑,将身份验证权限保留在本地,同时将SSO扩展到云资源。

使用时机

  • 部署或配置本地环境中的联合身份能力时
  • 建立符合合规要求的安全控制时
  • 构建或改进此领域的安全架构时
  • 进行需要此实现的安全评估时

前提条件

  • 本地Active Directory域
  • AD FS 2019+ 或第三方SAML IdP(Okta、Ping等)
  • Microsoft Entra ID租户(建议使用P1或P2许可证)
  • Azure AD Connect(如果使用密码哈希同步作为备份的混合身份)
  • 用于联合端点的公共TLS证书
  • 联合服务名称的DNS记录

核心概念

联合模型

模型身份验证授权使用场景
联合(AD FS)本地AD FS法规要求将身份验证保留在本地
托管(PHS)带密码哈希同步的Azure AD最简云身份验证,无需AD FS
托管(PTA)通过直通代理的本地验证云身份验证针对本地AD验证
第三方联合外部IdP(Okta、Ping)多IdP环境

SAML联合架构

用户 → 云应用(SP)
   │
   └── 重定向到Azure AD
          │
          ├── Azure AD检查联合域
          │
          └── 重定向到本地AD FS
                 │
                 ├── AD FS针对Active Directory进行身份验证
                 │
                 ├── AD FS颁发SAML令牌
                 │
                 └── 令牌回传给Azure AD
                        │
                        ├── Azure AD验证联合信任
                        │
                        ├── Azure AD颁发自己的令牌
                        │
                        └── 用户获取云应用的访问令牌

联合信任组件

组件描述
令牌签名证书IdP用于签名SAML断言的X.509证书
联合元数据描述IdP端点和能力的XML文档
信赖方信任每个SP(Azure AD)在AD FS中的配置
声明规则将AD属性转换为SAML声明
颁发者URIIdP的唯一标识符(实体ID)

工作流

第1步:准备AD FS基础设施

# 安装AD FS角色
Install-WindowsFeature ADFS-Federation -IncludeManagementTools

# 配置AD FS场
Install-AdfsFarm `
    -CertificateThumbprint $certThumbprint `
    -FederationServiceDisplayName

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相关技能