CertSafari
    Snowflake SnowPro Specialty: Gen AI (GES-C02)· Lessons

    Domain 3 · Lesson 8/15

    Cortex data safety: cross-region inference, guardrails, AI_REDACT and REST API auth

    Set up model access controls.

    11 min read
    7.25% of exam
    6 sources
    Published 21 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Choose a CORTEX_ENABLED_CROSS_REGION value that fits a data residency requirement, and know who can set it
    • Tell Cortex AI Guardrails apart from Cortex Guard, and turn each one on
    • Use model settings and output filtering to keep generated responses focused
    • Detect or mask PII with AI_REDACT before text is stored or sent to another prompt
    • Authenticate to the Cortex REST API and give the calling role the privileges it needs

    1.Cross-region inference and data residency

    Deciding who may call which model is half of governing Cortex. The other half is what happens to the data in a prompt. The first question is where the prompt is processed. A single account-level parameter, CORTEX_ENABLED_CROSS_REGION, decides whether Snowflake may send inference requests to regions outside your account's home region. Many frontier models and Cortex products are only available with cross-region inference enabled.

    CORTEX_ENABLED_CROSS_REGION routing options, from most flexible to most restrictive
    TypeParameter valueWhere requests can be processed
    GlobalANY_REGIONAny Snowflake-supported region, on any cloud provider
    Cloud-specificAWS_GLOBAL, AZURE_GLOBAL, GCP_GLOBAL, or combinationsOnly within the named cloud provider
    RegionalAWS_US, AWS_EU, AWS_APJ, AWS_JP, AWS_AU, AZURE_US, AZURE_EU, GCP_US, or combinationsOnly within the named cloud provider and geography
    DisabledDISABLEDOnly the account's home region

    Only ACCOUNTADMIN can change the parameter, and only with ALTER ACCOUNT. It cannot be set at the user or session level, and ORGADMIN cannot set it. If it was never set, the account inherits a default. Organizations created after March 9, 2026 get ANY_REGION. Other commercial accounts get a same-cloud geography value such as AWS_US or AZURE_EU. If you have residency requirements, set the value explicitly instead of relying on the default.

    Cross-region inference moves only the inference payload: the prompt you send and the response you get back. That payload goes to the processing region temporarily and is not stored there. Your stored data stays in your account's region. Inside one cloud provider, traffic stays on the provider's private backbone. Between providers, it crosses the public internet over mTLS. Credits are counted in the requesting region, and there is no egress charge. DISABLED is the strictest option, but it limits you to the models and features deployed in your region. A model you have been granted can then still fail with what looks like an access error.

    Checkpoint 1 of 6· Match them up

    Match each CORTEX_ENABLED_CROSS_REGION value to where Snowflake may process inference requests

    Tap a term, then the definition that fits it.

    Checkpoint 2 of 6· Check yourself

    A data team in an EU account wants Cortex requests limited to AWS EU regions. How can this be configured?

    Sources1

    2.Two guardrails: Cortex AI Guardrails and Cortex Guard

    Snowflake has two guardrail features with similar names, and they protect different things. Cortex AI Guardrails defend agents against adversarial input such as prompt injection and jailbreaks. Cortex Guard filters harmful output from a single completion. Mixing them up leads to the wrong setting being turned on.

    Cortex AI Guardrails compared with Cortex Guard
    AspectCortex AI GuardrailsCortex Guard
    Protects againstPrompt injection (including indirect injection in tool outputs), jailbreaks, previously unknown attack patternsUnsafe and harmful model responses such as violent crimes, hate, sexual content and self-harm
    Applies toCoCo, Snowflake CoWork, Cortex AgentsAI_COMPLETE and SNOWFLAKE.CORTEX.COMPLETE
    How to turn onALTER ACCOUNT SET AI_SETTINGS (ACCOUNTADMIN)guardrails: TRUE in the model_parameters argument
    BillingCredits based on tokens scannedCompute charges on input tokens processed, on top of AI_COMPLETE charges
    Turn on Cortex AI Guardrails for the accountsql
    ALTER ACCOUNT SET AI_SETTINGS = $$
      guardrails:
        advanced_prompt_injection:
          - enabled: true
    $$;

    Cortex AI Guardrails depend on your cross-region setting. They are available only to Commercial accounts (not Gov, VPS or Sovereign) whose CORTEX_ENABLED_CROSS_REGION is ANY_REGION, AWS_US, AWS_EU, AWS_JP, AWS_APJ or AWS_GLOBAL. An account set to DISABLED or to an Azure-only value cannot turn them on. ALTER ACCOUNT UNSET AI_SETTINGS turns them off. In SNOWFLAKE.ACCOUNT_USAGE.CORTEX_AI_GUARDRAILS_USAGE_HISTORY, flagged requests have GUARDRAILS_SIGNAL = TRUE. Check this view regularly, because some legitimate prompts get flagged.

    Cortex Guard is built on Meta's Llama Guard 3. It checks a model's response before that response reaches your application, so filtering happens per call rather than through an account setting.

    Checkpoint 3 of 6· Check yourself

    Instructions hidden in a tool's output could hijack your company's Cortex Agent. The Commercial account has CORTEX_ENABLED_CROSS_REGION set to AWS_US. Which setting protects the agent against this?

    Sources23

    3.Keeping generated output focused and filtered

    The levers inside AI_COMPLETE's model_parameters affect how predictable a response is. temperature runs from 0 to 1. Higher values such as 0.7 give more varied, random output. Lower values such as 0.2 make output more deterministic and focused. The default is 0. top_p is an alternative way to control randomness: it limits the set of tokens the model can choose from. max_tokens, default 4096, caps the length of the response, and small values can cut a response off.

    For pipelines where a response has to stay close to its input, such as extraction or classification feeding a table, keep temperature low. Add Cortex Guard where hateful or otherwise harmful text must never reach users. Treat neither as proof the output is correct. Snowflake describes its AI-based detection as best effort, and checking output against your own policies remains your job. Cortex Playground lets you try different temperature, top_p and max_tokens values and turn Cortex Guard on before you write the SQL.

    Checkpoint 4 of 6· Check yourself

    Your team's extraction pipeline writes AI_COMPLETE output into a table. It runs with temperature set to 0 and guardrails: TRUE in model_parameters. What is still true about the rows it produces?

    Sources34

    4.Masking PII with AI_REDACT

    AI_REDACT uses an LLM to find personally identifiable information in unstructured text, so you can remove it before the text is stored, analysed or sent on to another prompt. Its signature is AI_REDACT( <input> [, <categories> ] [, <return_error_details> ] [, <mode> ] ). The calling role needs the SNOWFLAKE.CORTEX_USER database role. For documents or audio, convert them to text first with AI_PARSE_DOCUMENT or AI_TRANSCRIBE.

    The function has two modes, and they produce different results:

    • redact (the default) returns a VARCHAR with each PII span replaced by a category placeholder, such as [NAME] or [ADDRESS].
    • detect returns an OBJECT with a spans array. Each entry gives the category, start, end and matched text, so your own code can choose what to mask.
    • categories is an ARRAY that limits which PII types are handled. If you leave it out, every supported category is redacted. An unsupported category name causes an error.

    The supported categories are NAME, EMAIL, PHONE_NUMBER, DATE_OF_BIRTH, GENDER, AGE, ADDRESS, NATIONAL_ID, PASSPORT, TAX_IDENTIFIER, PAYMENT_CARD_DATA, DRIVERS_LICENSE and IP_ADDRESS. Partial matches count: a first name on its own is redacted as [NAME].

    On large tables, one bad row can fail the whole query, because AI_REDACT raises an error by default. To keep going, set AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR to FALSE for the session. Failed rows then return NULL. If you also pass TRUE for return_error_details, each result is an OBJECT with value and error fields, so you can store the redacted text and the failures separately. Detection is best effort, so review the output against your privacy policy before treating text as clean.

    Checkpoint 5 of 6· Match them up

    A privacy team is choosing how to configure AI_REDACT for a large table of support tickets. Pair each configuration with what the function returns

    Tap a term, then the definition that fits it.

    Sources4

    5.Authenticating to the Cortex REST API

    The Cortex REST API uses the standard Snowflake REST API authentication methods. Put a token in the Authorization header: a JSON web token (JWT), an OAuth token or a programmatic access token (PAT). Consider creating a dedicated user for REST traffic. That keeps its grants and activity separate from people's interactive sessions.

    A REST request runs under the user's default role. Switching roles in a worksheet has no effect on it. That default role needs either SNOWFLAKE.CORTEX_USER, which covers all Covered AI features including the REST API, or SNOWFLAKE.CORTEX_REST_API_USER, which covers only the REST API. Most users already pass this check, because CORTEX_USER is granted to PUBLIC. If an administrator has revoked that grant, grant the role to a role that becomes the user's default. The REST API also respects the allowlist and model RBAC, so the default role needs access to the model it names.

    Set the role that REST requests will run undersql
    ALTER USER my_user SET DEFAULT_ROLE=my_role

    Checkpoint 6 of 6· Check yourself

    After moving to RBAC-only access, an account has CORTEX_MODELS_ALLOWLIST set to 'None' and the bootstrap all-models grant removed with the stored procedure. An administrator creates a dedicated REST user. That user's default role holds SNOWFLAKE.CORTEX_USER but no CORTEX-MODEL-ROLE application role. The user sends a Cortex REST API request with a valid PAT, and the request names claude-sonnet-4-6. What happens?

    Sources56

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Your customer data remains stored only in the region where your account is located.”
      ↩︎ Cross-region inference and data residency
      “Only the ACCOUNTADMIN role can modify this parameter using the ALTER ACCOUNT command.”
      ↩︎ Cross-region inference and data residency
      “If you have data residency requirements, set the parameter explicitly.”
      ↩︎ Cross-region inference and data residency
      “Data traverses the public internet using Mutual Transport Layer Security (mTLS), providing encrypted, mutually authenticated connections between Snowflake endpoints.”
      ↩︎ Cross-region inference and data residency
      “Your customer data is not persisted in the processing region.”
      ↩︎ Exam trap 1
      “This parameter cannot be set by the ORGADMIN role.”
      ↩︎ Exam trap 2
      “Credits are consumed in your requesting region, regardless of where the request is processed.”
      ↩︎ Prediction
      “Requests stay within designated cloud provider regions (for example, AWS US or Azure EU).”
      ↩︎ Checkpoint
      “Only the ACCOUNTADMIN role can modify this parameter using the ALTER ACCOUNT command. This parameter cannot be set by the ORGADMIN role.”
      ↩︎ Checkpoint
    2. 2.
      “provide run-time protection against prompt injection and jailbreak attacks on CoCo, Snowflake CoWork, and Cortex Agents.”
      ↩︎ Two guardrails: Cortex AI Guardrails and Cortex Guard
      “Cortex AI Guardrails are available to Commercial (non-Gov, VPS, Sovereign) accounts that have Cross-region inference enabled.”
      ↩︎ Two guardrails: Cortex AI Guardrails and Cortex Guard
      “Review which requests were flagged for possible prompt injection (GUARDRAILS_SIGNAL = TRUE)”
      ↩︎ Two guardrails: Cortex AI Guardrails and Cortex Guard
      “Cortex AI Guardrails at the account level using the AI_SETTINGS parameter. This provides centralized control over guardrail behavior for CoCo, Snowflake CoWork, and Cortex Agents”
      ↩︎ Checkpoint
    3. 3.
      “Cortex Guard works by evaluating the responses of a language model before that output is returned to the application.”
      ↩︎ Two guardrails: Cortex AI Guardrails and Cortex Guard
      “a lower temperature (such as 0.2) makes the output more deterministic and focused”
      ↩︎ Keeping generated output focused and filtered
      “language model responses which may be associated with violent crimes, hate, sexual content, self-harm, and more are automatically filtered”
      ↩︎ Keeping generated output focused and filtered
      “To enable Cortex Guard, set the guardrails option in the model_parameters argument to TRUE.”
      ↩︎ Exam trap 3
    4. 4.
      “AI_REDACT performs detection and redaction in a best-effort manner using AI models.”
      ↩︎ Keeping generated output focused and filtered
      “Use AI_REDACT in redact mode to replace PII in the input text with placeholder values.”
      ↩︎ Masking PII with AI_REDACT
      “identifies the location and category of each detected PII instance without redacting the text”
      ↩︎ Masking PII with AI_REDACT
      “If not specified, all supported PII categories are redacted.”
      ↩︎ Masking PII with AI_REDACT
      “Users must use a role that has been granted the SNOWFLAKE.CORTEX_USER database role.”
      ↩︎ Masking PII with AI_REDACT
      “To allow processing to continue with other rows, set the session parameter AI_SQL_ERROR_HANDLING_USE_FAIL_ON_ERROR to FALSE.”
      ↩︎ Masking PII with AI_REDACT
      “a first name alone is sufficient to trigger redaction with the [NAME] placeholder”
      ↩︎ Masking PII with AI_REDACT
      “AI_REDACT performs detection and redaction in a best-effort manner using AI models. Always review the output to ensure compliance with your organization’s data privacy policies.”
      ↩︎ Checkpoint
      “redact (default): Replaces detected PII with category placeholders, such as [NAME] and [ADDRESS]. detect: Returns an OBJECT that contains a spans array”
      ↩︎ Checkpoint
    5. 5.
      “Set the Authorization header to include your token (for example, a JSON web token (JWT), OAuth token, or programmatic access token).”
      ↩︎ Authenticating to the Cortex REST API
      “To send a REST API request, your default role must be granted either the SNOWFLAKE.CORTEX_USER database role or the SNOWFLAKE.CORTEX_REST_API_USER database role.”
      ↩︎ Authenticating to the Cortex REST API
      “so that role must have the necessary privileges.”
      ↩︎ Exam trap 4
    6. 6.
      “Model access controls are supported by the following features:”
      ↩︎ Authenticating to the Cortex REST API
      “Access is denied only if both checks fail.”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise the 26 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.