Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
- Latest
- 2025-02-01-preview
- 2025-01-01
- 2024-11-01-preview
- 2024-05-01-preview
- 2023-08-01
- 2023-08-01-preview
- 2023-05-01-preview
- 2023-02-01-preview
- 2022-11-01-preview
- 2022-08-01-preview
- 2022-05-01-preview
- 2022-02-01-preview
- 2021-11-01
- 2021-11-01-preview
- 2021-08-01-preview
- 2021-05-01-preview
- 2021-02-01-preview
- 2020-11-01-preview
- 2020-08-01-preview
- 2020-02-02-preview
- 2019-06-01-preview
- 2017-10-01-preview
- 2017-03-01-preview
- 2014-04-01
Definizione della risorsa Bicep
Il tipo di risorsa server/database può essere distribuito con operazioni destinate a:
Per un elenco delle proprietà modificate in ogni versione dell'API, vedere log delle modifiche.
Formato risorsa
Per creare un Microsoft. Risorsa SQL/server/database, aggiungi il seguente Bicep al tuo template.
resource symbolicname 'Microsoft.Sql/servers/databases@2014-04-01' = {
parent: resourceSymbolicName
location: 'string'
name: 'string'
properties: {
collation: 'string'
createMode: 'string'
edition: 'string'
elasticPoolName: 'string'
maxSizeBytes: 'string'
readScale: 'string'
recoveryServicesRecoveryPointResourceId: 'string'
requestedServiceObjectiveId: 'string'
requestedServiceObjectiveName: 'string'
restorePointInTime: 'string'
sampleName: 'string'
sourceDatabaseDeletionDate: 'string'
sourceDatabaseId: 'string'
zoneRedundant: bool
}
tags: {
{customized property}: 'string'
}
}
Valori delle proprietà
Microsoft. SQL/server/database
| Name | Description | Value |
|---|---|---|
| location | Percorso della risorsa. | stringa (obbligatorio) |
| name | Nome della risorsa | stringa (obbligatorio) |
| parent | In Bicep, puoi specificare la risorsa genitore per una risorsa figlia. È necessario aggiungere questa proprietà solo quando la risorsa figlio viene dichiarata all'esterno della risorsa padre. Per altre informazioni, vedere risorsa figlio all'esterno della risorsa padre. |
Nome simbolico per la risorsa di tipo: server |
| properties | Proprietà che rappresentano la risorsa. | DatabaseProperties |
| tags | Tag delle risorse | Dizionario di nomi e valori di tag. Vedere tag nei modelli |
DatabaseProperties
| Nome | Descrizione | Valore | | ---- | ----------- | ------------ | | regole di confronto | Regole di confronto del database. Se createMode non è Default, questo valore viene ignorato. | string | | createMode | Specifica la modalità di creazione del database.
Impostazione predefinita: creazione regolare del database.
Copia: crea un database come copia di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database di origine.
OnlineSecondary/NonReadableSecondary: crea un database come replica secondaria (leggibile o non leggibile) di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database primario esistente.
PointInTimeRestore: crea un database ripristinando un backup temporizzato di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database esistente e deve essere specificato restorePointInTime.
Ripristino: crea un database ripristinando un backup con replica geografica. sourceDatabaseId deve essere specificato come ID risorsa di database recuperabile da ripristinare.
Ripristino: crea un database ripristinando un backup di un database eliminato. sourceDatabaseId deve essere specificato. Se sourceDatabaseId è l'ID risorsa originale del database, è necessario specificare sourceDatabaseDeletionDate. In caso contrario, sourceDatabaseId deve essere l'ID risorsa del database eliminato ripristinabile e sourceDatabaseDeletionDate viene ignorato. è anche possibile specificare restorePointInTime per eseguire il ripristino da un punto precedente nel tempo.
RestoreLongTermRetentionBackup: crea un database ripristinando da un insieme di credenziali di conservazione a lungo termine. recoveryServicesRecoveryPointResourceId deve essere specificato come ID risorsa del punto di ripristino.
Copy, NonReadableSecondary, OnlineSecondary e RestoreLongTermRetentionBackup non sono supportati per l'edizione DataWarehouse. | 'Copia'
'Default'
'NonReadableSecondary'
'OnlineSecondary'
'PointInTimeRestore'
'Recovery'
'Restore'
'RestoreLongTermRetentionBackup' | | edizione | Edizione del database. L'enumerazione DatabaseEditions contiene tutte le edizioni valide. Se createMode è NonReadableSecondary o OnlineSecondary, questo valore viene ignorato.
L'elenco degli SKU può variare in base all'area geografica e all'offerta di supporto. Per determinare le SKU (inclusi il nome SKU, il livello/edizione, la famiglia e la capacità) disponibili per il tuo abbonamento in una regione Azure, usa l'API REST Capabilities_ListByLocation o uno dei seguenti comandi:
azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br />Powershell
<Get-AzSqlServerServiceObjective -Location posizione> | 'Basic'<br />'Business'<br />'BusinessCritical'<br />'DataWarehouse'<br />'Free'<br />'GeneralPurpose'<br />'Hyperscale'<br />'Premium'<br />'PremiumRS'<br />'Standard'<br />'Stretch'<br />'System'<br />'System2'<br />'Web' | | elasticPoolName | The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. | string | | maxSizeBytes | The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." | string | | readScale | Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. | 'Disabled'<br />'Enabled' | | recoveryServicesRecoveryPointResourceId | Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. | string | | requestedServiceObjectiveId | The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName.<br /><br />The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. | string <br /><br />Constraints:<br />Min length = 36<br />Max length = 36<br />Pattern = `^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$` | | requestedServiceObjectiveName | The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. <br /><br />The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands:<br /><br />```azurecli<br />az sql db list-editions -l <location> -o table<br />
```powershell
<Get-AzSqlServerServiceObjective -Location posizione>
```` | 'Di base'
'DS100'
'DS1000'
'DS1200'
'DS1500'
'DS200'
'DS2000'
'DS300'
'DS400'
'DS500'
'DS600'
'DW100'
'DW1000'
'DW10000c'
'DW1000c'
'DW1200'
'DW1500'
'DW15000c'
'DW1500c'
'DW200'
'DW2000'
'DW2000c'
'DW2500c'
'DW300'
'DW3000'
'DW30000c'
'DW3000c'
'DW400'
'DW500'
'DW5000c'
'DW600'
'DW6000'
'DW6000c'
'DW7500c'
'ElasticPool'
'Free'
'P1'
'P11'
'P15'
'P2'
'P3'
'P4'
'P6'
'PRS1'
'PRS2'
'PRS4'
'PRS6'
'S0'
'S1'
'S12'
'S2'
'S3'
'S4'
'S6'
'S7'
'S9'
'System'
'System0'
'System1'
'System2'
'System2L'
'System3'
'System3L'
'System4'
'System4L' | | restorePointInTime | Condizionale. Se createMode è PointInTimeRestore, questo valore è obbligatorio. Se createMode è Restore, questo valore è facoltativo. Specifica il punto nel tempo (formato ISO8601) del database di origine che verrà ripristinato per creare il nuovo database. Deve essere maggiore o uguale al valore meno recenteRestoreDate del database di origine. | string | | sampleName | Indica il nome dello schema di esempio da applicare durante la creazione del database. Se createMode non è Default, questo valore viene ignorato. Non supportato per l'edizione DataWarehouse. | 'AdventureWorksLT' | | sourceDatabaseDeletionDate | Condizionale. Se createMode è Restore e sourceDatabaseId è l'ID risorsa originale del database eliminato quando esiste (anziché il relativo ID database eliminato ripristinabile corrente), questo valore è obbligatorio. Specifica l'ora di eliminazione del database. | string | | sourceDatabaseId | Condizionale. Se createMode è Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery o Restore, questo valore è obbligatorio. Specifica l'ID risorsa del database di origine. Se createMode è NonReadableSecondary o OnlineSecondary, il nome del database di origine deve essere uguale al nuovo database in fase di creazione. | string | | zoneRedundant | Indipendentemente dal fatto che il database sia con ridondanza della zona, ovvero le repliche di questo database verranno distribuite in più zone di disponibilità. | bool |
TrackedResourceTags
| Name | Description | Value |
|---|
Esempi di utilizzo
Campioni di Bicep
Un esempio di base di distribuzione del database MS SQL.
param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator login password for the SQL server')
param administratorLoginPassword string
resource server 'Microsoft.Sql/servers@2021-02-01-preview' = {
name: resourceName
location: location
properties: {
administratorLogin: 'mradministrator'
administratorLoginPassword: null
minimalTlsVersion: '1.2'
publicNetworkAccess: 'Enabled'
restrictOutboundNetworkAccess: 'Disabled'
version: '12.0'
}
}
resource database 'Microsoft.Sql/servers/databases@2021-02-01-preview' = {
parent: server
name: resourceName
location: location
properties: {
autoPauseDelay: 0
createMode: 'Default'
elasticPoolId: ''
highAvailabilityReplicaCount: 0
isLedgerOn: false
licenseType: 'LicenseIncluded'
maintenanceConfigurationId: resourceId('Microsoft.Maintenance/publicMaintenanceConfigurations', 'SQL_Default')
minCapacity: 0
readScale: 'Disabled'
requestedBackupStorageRedundancy: 'Geo'
zoneRedundant: false
}
}
Azure Verified Modules
I seguenti Azure Moduli Verificati possono essere utilizzati per distribuire questo tipo di risorsa.
| Modulo | Description |
|---|---|
| database SQL di Azure | AVM Resource Module per database SQL di Azure |
Esempi di Azure Quickstart
I seguenti template Azure Quickstart contengono Bicep esempi per il deployment di questo tipo di risorsa.
| File Bicep | Description |
|---|---|
| Azure SQL Server con Audit scritto a Log Analytics | Questo template ti permette di distribuire un server Azure SQL con Auditing abilitato per scrivere log di audit su Log Analytics (OMS workspace) |
| Crea un SQL Server e un database | Questo modello consente di creare un database SQL e un server. |
| Pool SQL dedicato con crittografia trasparente | Crea un SQL Server e un pool SQL dedicato (precedentemente SQL DW) con Transparent Data Encryption. |
| Deploy the Sports Analytics su Azure Architecture | Crea un account di storage Azure con ADLS Gen 2 abilitato, un'istanza di Azure Data Factory con servizi collegati per l'account di storage (e il database SQL di Azure se distribuito) e un'istanza di Azure Databricks. All'identità di AAD per l'utente che distribuisce il modello e all'identità gestita per l'istanza di Azure Data Factory verrà concesso il ruolo Collaboratore ai dati del BLOB di archiviazione nell'account di archiviazione. Ci sono anche opzioni per distribuire un'istanza Azure Key Vault, un database SQL di Azure e un Azure Event Hub (per casi d'uso in streaming). Quando viene distribuito un Azure Key Vault, l'identità gestita dalla data factory e l'identità AAD per l'utente che distribuisce il template riceveranno il ruolo di utente Key Vault Secrets. |
| Questo modello mostra come creare un endpoint privato che punta ad Azure SQL Server | |
| Provisiona un'app web con un database SQL | Questo modello effettua il provisioning di un'app Web, un database SQL, impostazioni di scalabilità automatica, regole di avviso e Informazioni dettagliate app. Configura una stringa di connessione nell'app web per il database. |
| Sonarqube Docker Web App su Linux con Azure SQL | Questo template distribuisce Sonarqube in un container Linux di Servizio app di Azure web app utilizzando l'immagine ufficiale Sonarqube e supportato da un Azure SQL Server. |
| Web App con Managed Identity, SQL Server e ΑΙ | Esempio semplice per distribuire l'infrastruttura Azure per app + dati + identità gestita + monitoraggio |
Definizione di risorsa del modello di Resource Manager
Il tipo di risorsa server/database può essere distribuito con operazioni destinate a:
Per un elenco delle proprietà modificate in ogni versione dell'API, vedere log delle modifiche.
Formato risorsa
Per creare un Microsoft. Sql/server/databases, aggiungi il seguente JSON al tuo template.
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2014-04-01",
"name": "string",
"location": "string",
"properties": {
"collation": "string",
"createMode": "string",
"edition": "string",
"elasticPoolName": "string",
"maxSizeBytes": "string",
"readScale": "string",
"recoveryServicesRecoveryPointResourceId": "string",
"requestedServiceObjectiveId": "string",
"requestedServiceObjectiveName": "string",
"restorePointInTime": "string",
"sampleName": "string",
"sourceDatabaseDeletionDate": "string",
"sourceDatabaseId": "string",
"zoneRedundant": "bool"
},
"tags": {
"{customized property}": "string"
}
}
Valori delle proprietà
Microsoft. SQL/server/database
| Name | Description | Value |
|---|---|---|
| apiVersion | Versione dell'API | '2014-04-01' |
| location | Percorso della risorsa. | stringa (obbligatorio) |
| name | Nome della risorsa | stringa (obbligatorio) |
| properties | Proprietà che rappresentano la risorsa. | DatabaseProperties |
| tags | Tag delle risorse | Dizionario di nomi e valori di tag. Vedere tag nei modelli |
| type | Tipo di risorsa | 'Microsoft. Sql/server/database' |
DatabaseProperties
| Nome | Descrizione | Valore | | ---- | ----------- | ------------ | | regole di confronto | Regole di confronto del database. Se createMode non è Default, questo valore viene ignorato. | string | | createMode | Specifica la modalità di creazione del database.
Impostazione predefinita: creazione regolare del database.
Copia: crea un database come copia di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database di origine.
OnlineSecondary/NonReadableSecondary: crea un database come replica secondaria (leggibile o non leggibile) di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database primario esistente.
PointInTimeRestore: crea un database ripristinando un backup temporizzato di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database esistente e deve essere specificato restorePointInTime.
Ripristino: crea un database ripristinando un backup con replica geografica. sourceDatabaseId deve essere specificato come ID risorsa di database recuperabile da ripristinare.
Ripristino: crea un database ripristinando un backup di un database eliminato. sourceDatabaseId deve essere specificato. Se sourceDatabaseId è l'ID risorsa originale del database, è necessario specificare sourceDatabaseDeletionDate. In caso contrario, sourceDatabaseId deve essere l'ID risorsa del database eliminato ripristinabile e sourceDatabaseDeletionDate viene ignorato. è anche possibile specificare restorePointInTime per eseguire il ripristino da un punto precedente nel tempo.
RestoreLongTermRetentionBackup: crea un database ripristinando da un insieme di credenziali di conservazione a lungo termine. recoveryServicesRecoveryPointResourceId deve essere specificato come ID risorsa del punto di ripristino.
Copy, NonReadableSecondary, OnlineSecondary e RestoreLongTermRetentionBackup non sono supportati per l'edizione DataWarehouse. | 'Copia'
'Default'
'NonReadableSecondary'
'OnlineSecondary'
'PointInTimeRestore'
'Recovery'
'Restore'
'RestoreLongTermRetentionBackup' | | edizione | Edizione del database. L'enumerazione DatabaseEditions contiene tutte le edizioni valide. Se createMode è NonReadableSecondary o OnlineSecondary, questo valore viene ignorato.
L'elenco degli SKU può variare in base all'area geografica e all'offerta di supporto. Per determinare le SKU (inclusi il nome SKU, il livello/edizione, la famiglia e la capacità) disponibili per il tuo abbonamento in una regione Azure, usa l'API REST Capabilities_ListByLocation o uno dei seguenti comandi:
azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br />Powershell
<Get-AzSqlServerServiceObjective -Location posizione> | 'Basic'<br />'Business'<br />'BusinessCritical'<br />'DataWarehouse'<br />'Free'<br />'GeneralPurpose'<br />'Hyperscale'<br />'Premium'<br />'PremiumRS'<br />'Standard'<br />'Stretch'<br />'System'<br />'System2'<br />'Web' | | elasticPoolName | The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. | string | | maxSizeBytes | The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." | string | | readScale | Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. | 'Disabled'<br />'Enabled' | | recoveryServicesRecoveryPointResourceId | Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. | string | | requestedServiceObjectiveId | The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName.<br /><br />The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. | string <br /><br />Constraints:<br />Min length = 36<br />Max length = 36<br />Pattern = `^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$` | | requestedServiceObjectiveName | The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. <br /><br />The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands:<br /><br />```azurecli<br />az sql db list-editions -l <location> -o table<br />
```powershell
<Get-AzSqlServerServiceObjective -Location posizione>
```` | 'Di base'
'DS100'
'DS1000'
'DS1200'
'DS1500'
'DS200'
'DS2000'
'DS300'
'DS400'
'DS500'
'DS600'
'DW100'
'DW1000'
'DW10000c'
'DW1000c'
'DW1200'
'DW1500'
'DW15000c'
'DW1500c'
'DW200'
'DW2000'
'DW2000c'
'DW2500c'
'DW300'
'DW3000'
'DW30000c'
'DW3000c'
'DW400'
'DW500'
'DW5000c'
'DW600'
'DW6000'
'DW6000c'
'DW7500c'
'ElasticPool'
'Free'
'P1'
'P11'
'P15'
'P2'
'P3'
'P4'
'P6'
'PRS1'
'PRS2'
'PRS4'
'PRS6'
'S0'
'S1'
'S12'
'S2'
'S3'
'S4'
'S6'
'S7'
'S9'
'System'
'System0'
'System1'
'System2'
'System2L'
'System3'
'System3L'
'System4'
'System4L' | | restorePointInTime | Condizionale. Se createMode è PointInTimeRestore, questo valore è obbligatorio. Se createMode è Restore, questo valore è facoltativo. Specifica il punto nel tempo (formato ISO8601) del database di origine che verrà ripristinato per creare il nuovo database. Deve essere maggiore o uguale al valore meno recenteRestoreDate del database di origine. | string | | sampleName | Indica il nome dello schema di esempio da applicare durante la creazione del database. Se createMode non è Default, questo valore viene ignorato. Non supportato per l'edizione DataWarehouse. | 'AdventureWorksLT' | | sourceDatabaseDeletionDate | Condizionale. Se createMode è Restore e sourceDatabaseId è l'ID risorsa originale del database eliminato quando esiste (anziché il relativo ID database eliminato ripristinabile corrente), questo valore è obbligatorio. Specifica l'ora di eliminazione del database. | string | | sourceDatabaseId | Condizionale. Se createMode è Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery o Restore, questo valore è obbligatorio. Specifica l'ID risorsa del database di origine. Se createMode è NonReadableSecondary o OnlineSecondary, il nome del database di origine deve essere uguale al nuovo database in fase di creazione. | string | | zoneRedundant | Indipendentemente dal fatto che il database sia con ridondanza della zona, ovvero le repliche di questo database verranno distribuite in più zone di disponibilità. | bool |
TrackedResourceTags
| Name | Description | Value |
|---|
Esempi di utilizzo
Modelli di Avvio Rapido Azure
I seguenti template Azure Quickstart distribuiscono questo tipo di risorsa.
| Template | Description |
|---|---|
|
Azure SQL Server con Audit scritto a Log Analytics |
Questo template ti permette di distribuire un server Azure SQL con Auditing abilitato per scrivere log di audit su Log Analytics (OMS workspace) |
|
Crea un SQL Server e un database |
Questo modello consente di creare un database SQL e un server. |
|
Pool SQL dedicato con crittografia trasparente |
Crea un SQL Server e un pool SQL dedicato (precedentemente SQL DW) con Transparent Data Encryption. |
|
Distribuisci un nuovo SQL Elastic Pool |
Questo template ti permette di distribuire un nuovo SQL Elastic Pool con il nuovo SQL Server associato e nuovi database SQL da assegnare. |
|
Deploy the Sports Analytics su Azure Architecture |
Crea un account di storage Azure con ADLS Gen 2 abilitato, un'istanza di Azure Data Factory con servizi collegati per l'account di storage (e il database SQL di Azure se distribuito) e un'istanza di Azure Databricks. All'identità di AAD per l'utente che distribuisce il modello e all'identità gestita per l'istanza di Azure Data Factory verrà concesso il ruolo Collaboratore ai dati del BLOB di archiviazione nell'account di archiviazione. Ci sono anche opzioni per distribuire un'istanza Azure Key Vault, un database SQL di Azure e un Azure Event Hub (per casi d'uso in streaming). Quando viene distribuito un Azure Key Vault, l'identità gestita dalla data factory e l'identità AAD per l'utente che distribuisce il template riceveranno il ruolo di utente Key Vault Secrets. |
|
HDInsight con Ambari personalizzato + database Metastore Hive in VNET |
Questo modello consente di creare un cluster HDInsight in una rete virtuale esistente con un nuovo database SQL che funge sia da database Ambari personalizzato che da metastore Hive. È necessario disporre di un server SQL esistente, un account di archiviazione e una rete virtuale. |
| Questo modello mostra come creare un endpoint privato che punta ad Azure SQL Server | |
|
Provisiona un'app web con un database SQL |
Questo modello effettua il provisioning di un'app Web, un database SQL, impostazioni di scalabilità automatica, regole di avviso e Informazioni dettagliate app. Configura una stringa di connessione nell'app web per il database. |
|
Desktop remoto Servizi ad alta disponibilità |
Questo codice di esempio ARM Template implementerà un laboratorio Desktop remoto Services 2019 Session Collection con alta disponibilità. L'obiettivo è distribuire una soluzione completamente ridondante e altamente disponibile per Desktop remoto Services, utilizzando Windows Server 2019. |
|
Sonarqube Docker Web App su Linux con Azure SQL |
Questo template distribuisce Sonarqube in un container Linux di Servizio app di Azure web app utilizzando l'immagine ufficiale Sonarqube e supportato da un Azure SQL Server. |
|
Web App con Managed Identity, SQL Server e ΑΙ |
Esempio semplice per distribuire l'infrastruttura Azure per app + dati + identità gestita + monitoraggio |
|
WebApp che consuma un Azure SQL Private Endpoint |
Questo modello mostra come creare un'app Web che consumi un endpoint privato che punta ad Azure SQL Server |
Definizione di risorsa Terraform (provider AzAPI)
Il tipo di risorsa server/database può essere distribuito con operazioni destinate a:
- Gruppi di risorse
Per un elenco delle proprietà modificate in ogni versione dell'API, vedere log delle modifiche.
Formato risorsa
Per creare un Microsoft. Sql/server/databases, aggiungi il seguente Terraform al tuo template.
resource "azapi_resource" "symbolicname" {
type = "Microsoft.Sql/servers/databases@2014-04-01"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
collation = "string"
createMode = "string"
edition = "string"
elasticPoolName = "string"
maxSizeBytes = "string"
readScale = "string"
recoveryServicesRecoveryPointResourceId = "string"
requestedServiceObjectiveId = "string"
requestedServiceObjectiveName = "string"
restorePointInTime = "string"
sampleName = "string"
sourceDatabaseDeletionDate = "string"
sourceDatabaseId = "string"
zoneRedundant = bool
}
}
}
Valori delle proprietà
Microsoft. SQL/server/database
| Name | Description | Value |
|---|---|---|
| location | Percorso della risorsa. | stringa (obbligatorio) |
| name | Nome della risorsa | stringa (obbligatorio) |
| parent_id | ID della risorsa padre per questa risorsa. | ID per la risorsa di tipo: server |
| properties | Proprietà che rappresentano la risorsa. | DatabaseProperties |
| tags | Tag delle risorse | Dizionario di nomi e valori di tag. |
| type | Tipo di risorsa | "Microsoft. Sql/server/databases@2014-04-01" |
DatabaseProperties
| Nome | Descrizione | Valore | | ---- | ----------- | ------------ | | regole di confronto | Regole di confronto del database. Se createMode non è Default, questo valore viene ignorato. | string | | createMode | Specifica la modalità di creazione del database.
Impostazione predefinita: creazione regolare del database.
Copia: crea un database come copia di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database di origine.
OnlineSecondary/NonReadableSecondary: crea un database come replica secondaria (leggibile o non leggibile) di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database primario esistente.
PointInTimeRestore: crea un database ripristinando un backup temporizzato di un database esistente. sourceDatabaseId deve essere specificato come ID risorsa del database esistente e deve essere specificato restorePointInTime.
Ripristino: crea un database ripristinando un backup con replica geografica. sourceDatabaseId deve essere specificato come ID risorsa di database recuperabile da ripristinare.
Ripristino: crea un database ripristinando un backup di un database eliminato. sourceDatabaseId deve essere specificato. Se sourceDatabaseId è l'ID risorsa originale del database, è necessario specificare sourceDatabaseDeletionDate. In caso contrario, sourceDatabaseId deve essere l'ID risorsa del database eliminato ripristinabile e sourceDatabaseDeletionDate viene ignorato. è anche possibile specificare restorePointInTime per eseguire il ripristino da un punto precedente nel tempo.
RestoreLongTermRetentionBackup: crea un database ripristinando da un insieme di credenziali di conservazione a lungo termine. recoveryServicesRecoveryPointResourceId deve essere specificato come ID risorsa del punto di ripristino.
Copy, NonReadableSecondary, OnlineSecondary e RestoreLongTermRetentionBackup non sono supportati per l'edizione DataWarehouse. | 'Copia'
'Default'
'NonReadableSecondary'
'OnlineSecondary'
'PointInTimeRestore'
'Recovery'
'Restore'
'RestoreLongTermRetentionBackup' | | edizione | Edizione del database. L'enumerazione DatabaseEditions contiene tutte le edizioni valide. Se createMode è NonReadableSecondary o OnlineSecondary, questo valore viene ignorato.
L'elenco degli SKU può variare in base all'area geografica e all'offerta di supporto. Per determinare le SKU (inclusi il nome SKU, il livello/edizione, la famiglia e la capacità) disponibili per il tuo abbonamento in una regione Azure, usa l'API REST Capabilities_ListByLocation o uno dei seguenti comandi:
azurecli<br />az sql db list-editions -l <location> -o table<br />````<br /><br />Powershell
<Get-AzSqlServerServiceObjective -Location posizione> | 'Basic'<br />'Business'<br />'BusinessCritical'<br />'DataWarehouse'<br />'Free'<br />'GeneralPurpose'<br />'Hyperscale'<br />'Premium'<br />'PremiumRS'<br />'Standard'<br />'Stretch'<br />'System'<br />'System2'<br />'Web' | | elasticPoolName | The name of the elastic pool the database is in. If elasticPoolName and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveName is ignored. Not supported for DataWarehouse edition. | string | | maxSizeBytes | The max size of the database expressed in bytes. If createMode is not Default, this value is ignored. To see possible values, query the capabilities API (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) referred to by operationId: "Capabilities_ListByLocation." | string | | readScale | Conditional. If the database is a geo-secondary, readScale indicates whether read-only connections are allowed to this database or not. Not supported for DataWarehouse edition. | 'Disabled'<br />'Enabled' | | recoveryServicesRecoveryPointResourceId | Conditional. If createMode is RestoreLongTermRetentionBackup, then this value is required. Specifies the resource ID of the recovery point to restore from. | string | | requestedServiceObjectiveId | The configured service level objective ID of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of currentServiceObjectiveId property. If requestedServiceObjectiveId and requestedServiceObjectiveName are both updated, the value of requestedServiceObjectiveId overrides the value of requestedServiceObjectiveName.<br /><br />The list of SKUs may vary by region and support offer. To determine the service objective ids that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API. | string <br /><br />Constraints:<br />Min length = 36<br />Max length = 36<br />Pattern = `^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$` | | requestedServiceObjectiveName | The name of the configured service level objective of the database. This is the service level objective that is in the process of being applied to the database. Once successfully updated, it will match the value of serviceLevelObjective property. <br /><br />The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the `Capabilities_ListByLocation` REST API or one of the following commands:<br /><br />```azurecli<br />az sql db list-editions -l <location> -o table<br />
```powershell
<Get-AzSqlServerServiceObjective -Location posizione>
```` | 'Di base'
'DS100'
'DS1000'
'DS1200'
'DS1500'
'DS200'
'DS2000'
'DS300'
'DS400'
'DS500'
'DS600'
'DW100'
'DW1000'
'DW10000c'
'DW1000c'
'DW1200'
'DW1500'
'DW15000c'
'DW1500c'
'DW200'
'DW2000'
'DW2000c'
'DW2500c'
'DW300'
'DW3000'
'DW30000c'
'DW3000c'
'DW400'
'DW500'
'DW5000c'
'DW600'
'DW6000'
'DW6000c'
'DW7500c'
'ElasticPool'
'Free'
'P1'
'P11'
'P15'
'P2'
'P3'
'P4'
'P6'
'PRS1'
'PRS2'
'PRS4'
'PRS6'
'S0'
'S1'
'S12'
'S2'
'S3'
'S4'
'S6'
'S7'
'S9'
'System'
'System0'
'System1'
'System2'
'System2L'
'System3'
'System3L'
'System4'
'System4L' | | restorePointInTime | Condizionale. Se createMode è PointInTimeRestore, questo valore è obbligatorio. Se createMode è Restore, questo valore è facoltativo. Specifica il punto nel tempo (formato ISO8601) del database di origine che verrà ripristinato per creare il nuovo database. Deve essere maggiore o uguale al valore meno recenteRestoreDate del database di origine. | string | | sampleName | Indica il nome dello schema di esempio da applicare durante la creazione del database. Se createMode non è Default, questo valore viene ignorato. Non supportato per l'edizione DataWarehouse. | 'AdventureWorksLT' | | sourceDatabaseDeletionDate | Condizionale. Se createMode è Restore e sourceDatabaseId è l'ID risorsa originale del database eliminato quando esiste (anziché il relativo ID database eliminato ripristinabile corrente), questo valore è obbligatorio. Specifica l'ora di eliminazione del database. | string | | sourceDatabaseId | Condizionale. Se createMode è Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery o Restore, questo valore è obbligatorio. Specifica l'ID risorsa del database di origine. Se createMode è NonReadableSecondary o OnlineSecondary, il nome del database di origine deve essere uguale al nuovo database in fase di creazione. | string | | zoneRedundant | Indipendentemente dal fatto che il database sia con ridondanza della zona, ovvero le repliche di questo database verranno distribuite in più zone di disponibilità. | bool |
TrackedResourceTags
| Name | Description | Value |
|---|
Esempi di utilizzo
Esempi di Terraform
Un esempio di base di distribuzione del database MS SQL.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the SQL server"
sensitive = true
}
data "azurerm_client_config" "current" {
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "server" {
type = "Microsoft.Sql/servers@2021-02-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
administratorLogin = "mradministrator"
administratorLoginPassword = var.administrator_login_password
minimalTlsVersion = "1.2"
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = "Disabled"
version = "12.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
data "azapi_resource_id" "publicMaintenanceConfiguration" {
type = "Microsoft.Maintenance/publicMaintenanceConfigurations@2023-04-01"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
name = "SQL_Default"
}
resource "azapi_resource" "database" {
type = "Microsoft.Sql/servers/databases@2021-02-01-preview"
parent_id = azapi_resource.server.id
name = var.resource_name
location = var.location
body = {
properties = {
autoPauseDelay = 0
createMode = "Default"
elasticPoolId = ""
highAvailabilityReplicaCount = 0
isLedgerOn = false
licenseType = "LicenseIncluded"
maintenanceConfigurationId = data.azapi_resource_id.publicMaintenanceConfiguration.id
minCapacity = 0
readScale = "Disabled"
requestedBackupStorageRedundancy = "Geo"
zoneRedundant = false
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
Un esempio di base di distribuzione del database MS SQL.
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
azurerm = {
source = "hashicorp/azurerm"
}
}
}
provider "azurerm" {
features {
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
variable "administrator_login_password" {
type = string
description = "The administrator login password for the SQL server"
sensitive = true
}
data "azurerm_client_config" "current" {
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "server" {
type = "Microsoft.Sql/servers@2021-02-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
administratorLogin = "mradministrator"
administratorLoginPassword = var.administrator_login_password
minimalTlsVersion = "1.2"
publicNetworkAccess = "Enabled"
restrictOutboundNetworkAccess = "Disabled"
version = "12.0"
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
data "azapi_resource_id" "publicMaintenanceConfiguration" {
type = "Microsoft.Maintenance/publicMaintenanceConfigurations@2023-04-01"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
name = "SQL_Default"
}
resource "azapi_resource" "database" {
type = "Microsoft.Sql/servers/databases@2021-02-01-preview"
parent_id = azapi_resource.server.id
name = var.resource_name
location = var.location
body = {
properties = {
autoPauseDelay = 0
createMode = "Default"
elasticPoolId = ""
highAvailabilityReplicaCount = 0
isLedgerOn = false
licenseType = "LicenseIncluded"
maintenanceConfigurationId = data.azapi_resource_id.publicMaintenanceConfiguration.id
minCapacity = 0
readScale = "Disabled"
requestedBackupStorageRedundancy = "Geo"
zoneRedundant = false
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}