New to Claude Skills? Learn how to install them →

mukul975 on GitHub

Zero Trust for SaaS Applications

Free

Enhance security for your SaaS apps with Zero Trust principles.

Get this skill

Free · Opens the source repo

What Zero Trust for SaaS Applications does

The Zero Trust for SaaS Applications skill provides a comprehensive approach to securing access to popular SaaS platforms such as Microsoft 365, Google Workspace, Salesforce, and Slack. By implementing a Zero Trust security model, this skill leverages Conditional Access Policies, Cloud Access Security Broker (CASB) solutions, and OAuth governance to ensure that only compliant devices and verified identities can access sensitive data. This is particularly crucial in today's environment where remote work and shadow IT can expose organizations to significant security risks.

The skill is structured around a clear workflow that begins with federating authentication through an Identity Provider (IdP). This centralizes user access and simplifies management. Next, it guides users in creating Conditional Access Policies that enforce Multi-Factor Authentication (MFA) and device compliance checks. These policies help block access from non-compliant devices and apply session-level controls to protect sensitive data. The skill also includes steps for deploying CASB solutions to discover shadow IT and manage unsanctioned applications, ensuring that all SaaS usage is monitored and controlled.

In addition to access control, the skill emphasizes the importance of OAuth app governance. It allows users to review and restrict permissions granted to OAuth applications, preventing excessive consent that could lead to data breaches. By following the outlined steps, organizations can effectively implement a Zero Trust architecture tailored for their SaaS applications, significantly reducing the risk of unauthorized access and data loss.

This skill is intended for security professionals, system administrators, and IT teams responsible for managing SaaS applications and ensuring compliance with security policies. It is particularly useful for organizations looking to enhance their security posture in a cloud-first world.

When to use it

Use this skill when implementing security measures for SaaS applications that require strict access controls, such as MFA and device compliance.

When not to use it

Avoid using this skill as a substitute for built-in SaaS security features or for applications lacking SAML/OIDC support.

What you can build with it

Securing Microsoft 365 Access

Use the skill to enforce MFA and device compliance for users accessing Microsoft 365, ensuring only secure devices can connect.

Governance of OAuth Permissions

Implement OAuth app governance to review and restrict permissions granted to applications, preventing excessive access.

Shadow IT Discovery

Deploy CASB to discover unsanctioned applications being used within your organization and apply appropriate controls.

How to install Zero Trust for SaaS Applications

View source

1. Install with the skills CLI

npx skills add mukul975/anthropic-cybersecurity-skills/implementing-zero-trust-for-saas-applications --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by mukul975

Implementing Zero Trust for SaaS Applications

When to Use

  • When securing access to SaaS applications (Microsoft 365, Google Workspace, Salesforce, Slack)
  • When implementing conditional access policies requiring MFA and device compliance for SaaS
  • When deploying CASB for shadow IT discovery and unsanctioned app blocking
  • When enforcing session-level controls (DLP, download restrictions) for sensitive SaaS data
  • When governing OAuth application permissions and detecting excessive consent grants

Do not use as a replacement for SaaS-native security controls (configure those first), for applications with no SAML/OIDC support, or when SaaS vendor does not support API integration for CASB/SSPM.

Prerequisites

  • Identity provider with conditional access: Microsoft Entra ID P1/P2, Okta
  • CASB solution: Microsoft Defender for Cloud Apps, Netskope, or Zscaler CASB
  • SaaS applications configured with SSO via SAML 2.0 or OIDC
  • MDM enrollment for device compliance signals (Intune, Jamf)
  • DLP policies defined for sensitive data categories

Workflow

Step 1: Federate SaaS Authentication Through Identity Provider

Centralize authentication for all SaaS applications through a single IdP.

# Configure SAML SSO for Salesforce via Entra ID
Connect-MgGraph -Scopes "Application.ReadWrite.All"

# Create enterprise application for Salesforce
$app = New-MgServicePrincipal -AppId "SALESFORCE_APP_ID" -DisplayName "Salesforce"

# Configure SAML SSO settings
$samlSettings = @{
    preferredSingleSignOnMode = "saml"
    samlSingleSignOnSettings = @{
        relayState = ""
    }
}
Update-MgServicePrincipal -ServicePrincipalId $app.Id -BodyParameter $samlSettings

# Assign user groups to the application
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $app.Id -BodyParameter @{
    principalId = "SALES_GROUP_ID"
    resourceId = $app.Id
    appRoleId = "DEFAULT_ROLE_ID"
}

Step 2: Create Conditional Access Policies for SaaS Applications

Enforce identity and device requirements before granting SaaS access.

# Block access from non-compliant devices to sensitive SaaS apps
$policy = @{
    displayName = "ZT - Require Compliant Device for SaaS"
    state = "enabled"
    conditions = @{
        applications = @{
            includeApplications = @("SALESFORCE_APP_ID", "M365_APP_ID", "SLACK_APP_ID")
        }
        users = @{
            includeUsers = @("All")
            excludeGroups = @("BREAK_GLASS_GROUP")
        }
        clientAppTypes = @("browser", "mobileAppsAndDesktopClients")
    }
    grantControls = @{
        operator = "AND"
        builtInControls = @("mfa", "compliantDevice")
    }
    sessionControls = @{
        cloudAppSecurity = @{
            isEnabled = $true
            cloudAppSecurityType = "mcasConfigured"
        }
        signInFrequency = @{
            value = 8
            type = "hours"
            isEnabled = $true
        }
    }
}
New-MgIdentityConditionalAccessPolicy -BodyParameter $policy

# Block downloads on unmanaged devices
$downloadPolicy = @{
    displayName = "ZT - Block Downloads on Unmanaged Devices"
    state = "enabled"
    conditions = @{
        applications = @{ includeApplications = @("SHAREPOINT_APP_ID") }
        users = @{ includeUsers = @("All") }
        devices = @{
            deviceFilter = @{
                mode = "include"
                rule = "device.isCompliant -ne True -or device.trustType -ne 'ServerAD'"
            }
        }
    }
    sessionControls = @{
        cloudAppSecurity = @{
            isEnabled = $true
            cloudAppSecurityType = "mcasConfigured"
        }
    }
}
New-MgIdentityConditionalAccessPolicy -BodyParameter $downloadPolicy

Step 3: Deploy CASB for Shadow IT Discovery and App Governance

Configure Microsoft Defender for Cloud Apps to discover and control SaaS usage.

# Query discovered cloud apps via Defender for Cloud Apps API
curl -X GET "https://api.cloudappsecurity.com/api/v1/discovery/" \
  -H "Authorization: Token ${MDCA_API_TOKEN}" \
  -H "Content-Type: application/json"

# Get list of unsanctioned apps
curl -X GET "https://api.cloudappsecurity.com/api/v1/discovery/discovered_apps/" \
  -H "Authorization: Token ${MDCA_API_TOKEN}" \
  -d '{
    "filters": {
      "appTag": {"eq": "unsanctioned"},
      "traffic": {"gte": 1000}
    },
    "sortField": "traffic",
    "sortDirection": "desc"
  }'

# Create session policy for DLP enforcement
curl -X POST "https://api.cloudappsecurity.com/api/v1/policies/" \
  -H "Authorization: Token ${MDCA_API_TOKEN}" \
  -d '{
    "name": "Block PII Upload to SaaS",
    "policyType": "SESSION",
    "severity": "HIGH",
    "enabled": true,
    "sessionPolicyType": "CONTROL_UPLOAD",
    "filters": {
      "fileType": {"eq": ["DOCUMENT", "SPREADSHEET"]},
      "contentInspection": {
        "dataType": ["CREDIT_CARD", "SSN", "PASSPORT"]
      }
    },
    "actions": {
      "block": true,
      "notify": {
        "emailRecipients": ["security-team@company.com"]
      }
    }
  }'

Step 4: Configure OAuth App Governance

Review and restrict OAuth application permissions to prevent excessive consent.

# Query OAuth apps with high-privilege permissions
$oauthApps = Invoke-MgGraphRequest -Method GET `
  "https://graph.microsoft.com/v1.0/servicePrincipals?\$filter=tags/any(t:t eq 'WindowsAzureActiveDirectoryIntegratedApp')&\$select=displayName,appId,oauth2PermissionScopes"

# Review consent grants
$grants = Get-MgOauth2PermissionGrant -All
$highRisk = $grants | Where-Object {
    $_.Scope -match "Mail.ReadWrite|Files.ReadWrite.All|Directory.ReadWrite.All"
}

Write-Host "High-risk OAuth grants: $($highRisk.Count)"
$highRisk | ForEach-Object {
    $sp = Get-MgServicePrincipal -ServicePrincipalId $_.ClientId
    Write-Host "  App: $($sp.DisplayName) | Scope: $($_.Scope) | Type: $($_.ConsentType)"
}

# Configure app consent policy to require admin approval
$consentPolicy = @{
    displayName = "Require Admin Approval for High-Risk Permissions"
    conditions = @{
        clientApplications = @{ includeAllClientApplications = $true }
        permissions = @{
            permissionClassification = "high"
            permissions = @(
                @{ permissionValue = "Mail.ReadWrite"; permissionType = "delegated" }
                @{ permissionValue = "Files.ReadWrite.All"; permissionType = "delegated" }
            )
        }
    }
}

Step 5: Implement SaaS Security Posture Management (SSPM)

Audit and remediate SaaS security configuration drift.

# Query SaaS security posture via CASB API
curl -X GET "https://api.cloudappsecurity.com/api/v1/security_config/" \
  -H "Authorization: Token ${MDCA_API_TOKEN}" \
  -d '{"app": "Microsoft 365"}'

# Common SSPM checks:
# - MFA enforcement for all admin accounts
# - External sharing restrictions in SharePoint/OneDrive
# - Email forwarding rules to external domains blocked
# - Idle session timeout configured (< 8 hours)
# - Legacy authentication protocols disabled
# - Admin consent workflow enabled
# - Conditional access policies active
# - Audit logging enabled for all services

Key Concepts

TermDefinition
CASBCloud Access Security Broker - intermediary enforcing security policies between users and SaaS applications
SSPMSaaS Security Posture Management - continuous monitoring of SaaS application security configurations
OAuth GovernanceReview and control of third-party application permissions granted through OAuth consent flows
Session ControlsReal-time access restrictions (block downloads, DLP inspection, watermarking) applied during active SaaS sessions
Shadow ITUnauthorized SaaS applications used by employees without IT approval or security review
Conditional AccessPolicy engine evaluating identity, device, location, and risk signals before granting SaaS access

Tools & Systems

  • Microsoft Defender for Cloud Apps: CASB providing shadow IT discovery, session controls, DLP, and SSPM
  • Microsoft Entra ID Conditional Access: Policy engine for identity-based access control to SaaS applications
  • Netskope CASB: Cloud-native CASB with inline and API-based SaaS security controls
  • Okta Identity Governance: OAuth app governance and access certification for SaaS applications
  • SSPM Tools: AppOmni, Adaptive Shield, Valence Security for SaaS configuration monitoring

Common Scenarios

Scenario: Securing Microsoft 365 and Salesforce for 1,000-User Organization

Context: A professional services firm with 1,000 users uses Microsoft 365, Salesforce, Slack, and 20+ other SaaS apps. Several data breaches in the industry drive a zero trust initiative for all SaaS access.

Approach:

  1. Federate all SaaS authentication through Entra ID with SAML SSO
  2. Create conditional access policies requiring MFA + compliant device for all SaaS apps
  3. Deploy Defender for Cloud Apps for shadow IT discovery (identify 150+ unauthorized apps)
  4. Mark unauthorized apps as unsanctioned and block via SWG/proxy
  5. Configure session controls: block downloads on unmanaged devices, DLP for file uploads
  6. Review OAuth app permissions: revoke 45 high-risk consent grants, enable admin approval workflow
  7. Enable SSPM monitoring for Microsoft 365 and Salesforce configurations
  8. Set up weekly automated posture reports for security leadership

Pitfalls: Conditional access policies need break-glass exclusions. Some legacy SaaS apps may not support modern authentication. Session controls require proxy-based CASB which can impact performance. OAuth app revocation may break integrations; coordinate with app owners first.

Output Format

Zero Trust SaaS Security Report
==================================================
Organization: ProServices Corp
Report Date: 2026-02-23

SAAS INVENTORY:
  Sanctioned Apps: 25
  Unsanctioned (blocked): 127
  Shadow IT Users: 342 (discovered in last 30 days)

CONDITIONAL ACCESS:
  Policies active: 8
  Sign-ins evaluated: 456,789
  Blocked by policy: 2,345 (0.5%)
  MFA enforced: 100% of sign-ins

DEVICE COMPLIANCE:
  Compliant device required: All 25 sanctioned apps
  Sign-ins from compliant: 448,123 (98.1%)
  Sign-ins blocked (non-compliant): 8,666

CASB / DLP:
  DLP violations detected: 89
  Files blocked from upload: 34
  Downloads blocked (unmanaged): 1,234

OAUTH GOVERNANCE:
  Total OAuth apps: 312
  High-risk permissions: 12 (reviewed)
  Revoked consents: 45
  Pending admin approval: 8

SSPM FINDINGS:
  Critical misconfigurations: 3
  High: 7
  Medium: 15
  Remediated this month: 18

Frequently asked questions about Zero Trust for SaaS Applications

Similar skills