Überblick über App-Spezifikationen

This topic describes how a provider can configure a Snowflake Native App to use app specifications to request controlled access from consumers. App specifications allow consumers to review and approve or decline requests for the following actions:

  • Connections to external endpoints outside of Snowflake

  • Authentication with third-party services

  • Data sharing with other Snowflake accounts

Types of controlled access for Snowflake Native Apps

Snowflake Native Apps often need to interact with resources beyond the consumer’s Snowflake account. These interactions can include connecting to external services, authenticating with third-party providers, or sharing data with other Snowflake accounts.

To access external services and share data, Snowflake provides the following objects:

Integration für externen Zugriff:

Ermöglichen Sie den sicheren Zugriff auf externe Netzwerkendpunkte innerhalb einer benutzerdefinierten Funktion oder einer gespeicherten Prozedur. Integrationen für den externen Zugriff verwenden Netzwerkregeln, um den Zugriff auf bestimmte externe Netzwerkstandorte zu beschränken.

Sicherheitsintegrationen:

Ermöglichen Sie den sicheren Zugriff für Authentifizierungsanbietende von Drittanbietern wie OAuth. Sicherheitsintegrationen bieten eine sichere Authentifizierung und Zugriffssteuerung.

Shares and listings:

Allow apps to share data back to providers or third-party Snowflake accounts. Shares contain database objects to be shared, and listings provide the mechanism to share data across accounts and regions.

When using automated granting of privileges, an app has the required privileges to create these objects when running the setup script. However, because these objects enable external connections or data sharing, consumers must approve these operations when configuring the app.

Die Verwendung der automatisierten Erteilung von Berechtigungen mit App-Spezifikationen hat die folgenden Vorteile:

  • Consumers do not have to manually create integrations, shares, or listings required by the app and approve access to them using references.

  • Anbietende müssen keinen Code schreiben, der während der Installation oder des Upgrades das Vorhandensein der erforderlichen Berechtigungen und Objekte prüft.

  • Consumers have clear visibility and control over external connections and data sharing requests.

Use app specifications for consumer approval

App specifications allow you to specify what controlled access the app requires. After the consumer installs the app, they review the app specification and approve or decline each request as necessary. This includes requests for external connections, authentication integrations, and data sharing permissions.

Definition von App-Spezifikationen

An app specification definition contains the properties that are required for the app to perform controlled operations such as external connections or data sharing. These properties are displayed to the consumer for approval. The app specification definition contains a subset of the metadata and properties specific to each type of operation: external access integration, security integration, or listing.

Informationen zur Definition der App-Spezifikation für Sicherheitsintegrationen finden Sie unter Definition von App-Spezifikationen für Sicherheitsintegrationen.

Informationen zur Definition der App-Spezifikation für Integrationen für den externen Zugriff finden Sie unter App specification definition for an EAI.

For information about the app specification definition for listings, see Create an app specification for a listing.

Sequence numbers of an app specification

Die Sequenznummer ähnelt einer Versionsnummer für die App-Spezifikation. Die Sequenznummern steigen automatisch inkrementell an, wenn ein Anbieter die Definition der App-Spezifikation ändert. Die Definition einer App-Spezifikation umfasst Konfigurationsdetails und andere erforderliche Informationen. Felder, die nicht Teil der Definition sind, wie z. B. description, triggern keine Aktualisierung der Sequenznummer.

Sequenznummern ermöglichen Anbietenden und Verbrauchenden, verschiedene Versionen einer App-Spezifikation zu identifizieren. Wenn ein Anbietender zum Beispiel ein neues Konfigurationsdetail zur Definition der App-Spezifikation hinzufügt, wird die Sequenznummer erhöht. Wenn der Verbrauchende die App-Spezifikation anzeigt, kann dieser sehen, dass sich die Sequenznummer geändert hat, und der Verbrauchende kann die aktualisierte App-Spezifikation überprüfen.

Best Practices bei der Verwendung von App-Spezifikationen

Automated granting of privileges ensures that the app has the required privileges to create objects like external access integrations, security integrations, or listings. However, consumers can choose to decline the app specification that enables external connections or data sharing. When developing an app, you must account for situations where app specifications might not be approved.

Consider the following scenarios:

  • An app might request multiple network ports for an external access integration, but the consumer might allow only one. The app should include logic to handle errors that occur if a network port is not available.

  • A data sharing request might be declined or only partially approved for some target accounts but not others. The app should gracefully handle these cases.

  • Authentication integrations might be rejected, requiring the app to use alternative methods.

As a best practice, always include proper error handling and provide clear feedback to consumers about which features require approved specifications to function.

Callback-Funktionen mit App-Spezifikationen verwenden

In some contexts, an app might need to know when the consumer has approved or declined an app specification. For example:

  • The app might need to wait until an external access specification is approved before making API calls.

  • Data population might need to start only after a listing specification is approved.

  • OAuth flows might need to be initialized after security integration approval.

Für diese Situation bietet Snowflake Native App Framework einen Mechanismus, mit dem Anbieter eine gespeicherte Callback-Prozedur definieren können, die ausgeführt wird, wenn der Verbraucher eine App-Spezifikation genehmigt oder ablehnt.

Anbieter können der Manifest-Datei eine gespeicherte Prozedur hinzufügen, wie im folgenden Beispiel gezeigt:

lifecycle_callbacks:
  specification_action: callbacks.on_spec_update
Copy

This example shows how to add a stored procedure named callbacks.on_spec_update to the manifest file. In the setup script, providers can add a stored procedure as shown in the following example:

CREATE OR REPLACE PROCEDURE callbacks.on_spec_update (
  name STRING,
  status STRING,
  payload STRING)
  ...
Copy

This example shows the signature of a stored procedure called callbacks.on_spec_update. You include the code in the body of this procedure to check the status of the app specification, create objects, and perform actions as required.