Static Sites - Create Or Update Static Site
Description for Creates a new static site in an existing resource group, or updates an existing static site.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/staticSites/{name}?api-version=2024-11-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
name
|
path | True |
string |
Name of the static site to create or update. |
resource
|
path | True |
string minLength: 1maxLength: 90 pattern: ^[-\w\._\(\)]+[^\.]$ |
Name of the resource group to which the resource belongs. |
subscription
|
path | True |
string |
Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). |
api-version
|
query | True |
string |
API Version |
Request Body
Name | Required | Type | Description |
---|---|---|---|
location | True |
string |
Resource Location. |
identity |
Managed service identity. |
||
kind |
string |
Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. |
|
properties.allowConfigFileUpdates |
boolean |
|
|
properties.branch |
string |
The target branch in the repository. |
|
properties.buildProperties |
Build properties to configure on the repository. |
||
properties.enterpriseGradeCdnStatus |
State indicating the status of the enterprise grade CDN serving traffic to the static web app. |
||
properties.provider |
string |
The provider that submitted the last deployment to the primary environment of the static site. |
|
properties.publicNetworkAccess |
string |
State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. |
|
properties.repositoryToken |
string |
A user's github repository token. This is used to setup the Github Actions workflow file and API secrets. |
|
properties.repositoryUrl |
string |
URL for the repository of the static site. |
|
properties.stagingEnvironmentPolicy |
State indicating whether staging environments are allowed or not allowed for a static web app. |
||
properties.templateProperties |
Template options for generating a new repository. |
||
sku |
Description of a SKU for a scalable resource. |
||
tags |
object |
Resource tags. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK. |
|
202 Accepted |
Asynchronous operation in progress. |
|
Other Status Codes |
App Service error response. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
Create or update a static site
Sample request
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0?api-version=2024-11-01
{
"location": "West US 2",
"properties": {
"repositoryUrl": "https://github.com/username/RepoName",
"branch": "master",
"repositoryToken": "repoToken123",
"buildProperties": {
"appLocation": "app",
"apiLocation": "api",
"appArtifactLocation": "build"
}
},
"sku": {
"name": "Basic",
"tier": "Basic"
}
}
Sample response
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0",
"name": "testStaticSite0",
"type": "Microsoft.Web/staticSites",
"location": "West US 2",
"properties": {
"defaultHostname": "happy-sea-15afae3e.azurestaticwebsites.net",
"repositoryUrl": "https://github.com/username/RepoName",
"branch": "demo",
"customDomains": [],
"privateEndpointConnections": [],
"contentDistributionEndpoint": "",
"keyVaultReferenceIdentity": "SystemAssigned",
"userProvidedFunctionApps": null,
"linkedBackends": [],
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true
},
"sku": {
"name": "Basic",
"tier": "Basic"
}
}
azure-asyncoperation: https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.Web/locations/westus2/operationResults/62e4d893-d233-4005-988e-a428d9f77076?api-version=2019-01-01
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/staticSites/testStaticSite0",
"name": "testStaticSite0",
"type": "Microsoft.Web/staticSites",
"location": "West US 2",
"properties": {
"defaultHostname": "happy-sea-15afae3e.azurestaticwebsites.net",
"repositoryUrl": "https://github.com/username/RepoName",
"branch": "demo",
"customDomains": [],
"privateEndpointConnections": [],
"contentDistributionEndpoint": "",
"keyVaultReferenceIdentity": "SystemAssigned",
"userProvidedFunctionApps": null,
"linkedBackends": [],
"stagingEnvironmentPolicy": "Enabled",
"allowConfigFileUpdates": true
},
"sku": {
"name": "Basic",
"tier": "Basic"
}
}
Definitions
Name | Description |
---|---|
Arm |
A wrapper for an ARM resource id |
Arm |
The plan object in Azure Resource Manager, represents a marketplace plan. |
Capability |
Describes the capabilities/features allowed for a specific SKU. |
Database |
Static Site Database Connection overview. |
Default |
App Service error response. |
Details | |
Enterprise |
State indicating the status of the enterprise grade CDN serving traffic to the static web app. |
Error |
Error model. |
Error |
Body of the error response returned from the API. |
Managed |
Managed service identity. |
Managed |
Type of managed service identity. |
Private |
The state of a private link connection |
Remote |
A remote private endpoint connection |
Response |
Message envelope that contains the common Azure resource manager properties and the resource provider specific content. |
Sku |
Description of the App Service plan scale options. |
Sku |
Description of a SKU for a scalable resource. |
Staging |
State indicating whether staging environments are allowed or not allowed for a static web app. |
Static |
Static Site ARM resource. |
Static |
Build properties for the static site. |
Static |
A database connection configuration file |
Static |
Static Site Linked Backend ARM resource. |
Static |
Template Options for the static site. |
Static |
A static site user provided function. |
user |
User Assigned identity. |
ArmIdWrapper
A wrapper for an ARM resource id
Name | Type | Description |
---|---|---|
id |
string |
ArmPlan
The plan object in Azure Resource Manager, represents a marketplace plan.
Name | Type | Description |
---|---|---|
name |
string |
The name. |
product |
string |
The product. |
promotionCode |
string |
The promotion code. |
publisher |
string |
The publisher. |
version |
string |
Version of product. |
Capability
Describes the capabilities/features allowed for a specific SKU.
Name | Type | Description |
---|---|---|
name |
string |
Name of the SKU capability. |
reason |
string |
Reason of the SKU capability. |
value |
string |
Value of the SKU capability. |
DatabaseConnectionOverview
Static Site Database Connection overview.
Name | Type | Description |
---|---|---|
configurationFiles |
A list of configuration files associated with this database connection. |
|
connectionIdentity |
string |
If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. |
name |
string |
If present, the name of this database connection resource. |
region |
string |
The region of the database resource. |
resourceId |
string |
The resource id of the database. |
DefaultErrorResponse
App Service error response.
Name | Type | Description |
---|---|---|
error |
Error model. |
Details
Name | Type | Description |
---|---|---|
code |
string |
Standardized string to programmatically identify the error. |
message |
string |
Detailed error description and debugging information. |
target |
string |
Detailed error description and debugging information. |
EnterpriseGradeCdnStatus
State indicating the status of the enterprise grade CDN serving traffic to the static web app.
Value | Description |
---|---|
Enabled | |
Enabling | |
Disabled | |
Disabling |
Error
Error model.
Name | Type | Description |
---|---|---|
code |
string |
Standardized string to programmatically identify the error. |
details |
Details[] |
Detailed errors. |
innererror |
string |
More information to debug error. |
message |
string |
Detailed error description and debugging information. |
target |
string |
Detailed error description and debugging information. |
ErrorEntity
Body of the error response returned from the API.
Name | Type | Description |
---|---|---|
code |
string |
Basic error code. |
details |
Error Details. |
|
extendedCode |
string |
Type of error. |
innerErrors |
Inner errors. |
|
message |
string |
Any details of the error. |
messageTemplate |
string |
Message template. |
parameters |
string[] |
Parameters for the template. |
target |
string |
The error target. |
ManagedServiceIdentity
Managed service identity.
Name | Type | Description |
---|---|---|
principalId |
string |
Principal Id of managed service identity. |
tenantId |
string |
Tenant of managed service identity. |
type |
Type of managed service identity. |
|
userAssignedIdentities |
<string,
user |
The list of user assigned identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} |
ManagedServiceIdentityType
Type of managed service identity.
Value | Description |
---|---|
SystemAssigned | |
UserAssigned | |
SystemAssigned, UserAssigned | |
None |
PrivateLinkConnectionState
The state of a private link connection
Name | Type | Description |
---|---|---|
actionsRequired |
string |
ActionsRequired for a private link connection |
description |
string |
Description of a private link connection |
status |
string |
Status of a private link connection |
RemotePrivateEndpointConnection
A remote private endpoint connection
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
kind |
string |
Kind of resource. |
name |
string |
Resource Name. |
properties.ipAddresses |
string[] |
Private IPAddresses mapped to the remote private endpoint |
properties.privateEndpoint |
PrivateEndpoint of a remote private endpoint connection |
|
properties.privateLinkServiceConnectionState |
The state of a private link connection |
|
properties.provisioningState |
string |
|
type |
string |
Resource type. |
ResponseMessageEnvelope[RemotePrivateEndpointConnection]
Message envelope that contains the common Azure resource manager properties and the resource provider specific content.
Name | Type | Description |
---|---|---|
error |
Azure-AsyncOperation Error info. |
|
id |
string |
Resource Id. Typically ID is populated only for responses to GET requests. Caller is responsible for passing in this value for GET requests only. For example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupId}/providers/Microsoft.Web/sites/{sitename} |
identity |
MSI resource |
|
location |
string |
Geographical region resource belongs to e.g. SouthCentralUS, SouthEastAsia. |
name |
string |
Name of resource. |
plan |
Azure resource manager plan. |
|
properties |
Resource specific properties. |
|
sku |
SKU description of the resource. |
|
status |
string |
Azure-AsyncOperation Status info. |
tags |
object |
Tags associated with resource. |
type |
string |
Type of resource e.g "Microsoft.Web/sites". |
zones |
string[] |
Logical Availability Zones the service is hosted in |
SkuCapacity
Description of the App Service plan scale options.
Name | Type | Description |
---|---|---|
default |
integer (int32) |
Default number of workers for this App Service plan SKU. |
elasticMaximum |
integer (int32) |
Maximum number of Elastic workers for this App Service plan SKU. |
maximum |
integer (int32) |
Maximum number of workers for this App Service plan SKU. |
minimum |
integer (int32) |
Minimum number of workers for this App Service plan SKU. |
scaleType |
string |
Available scale configurations for an App Service plan. |
SkuDescription
Description of a SKU for a scalable resource.
Name | Type | Description |
---|---|---|
capabilities |
Capabilities of the SKU, e.g., is traffic manager enabled? |
|
capacity |
integer (int32) |
Current number of instances assigned to the resource. |
family |
string |
Family code of the resource SKU. |
locations |
string[] |
Locations of the SKU. |
name |
string |
Name of the resource SKU. |
size |
string |
Size specifier of the resource SKU. |
skuCapacity |
Min, max, and default scale values of the SKU. |
|
tier |
string |
Service tier of the resource SKU. |
StagingEnvironmentPolicy
State indicating whether staging environments are allowed or not allowed for a static web app.
Value | Description |
---|---|
Enabled | |
Disabled |
StaticSiteARMResource
Static Site ARM resource.
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
identity |
Managed service identity. |
|
kind |
string |
Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. |
location |
string |
Resource Location. |
name |
string |
Resource Name. |
properties.allowConfigFileUpdates |
boolean |
|
properties.branch |
string |
The target branch in the repository. |
properties.buildProperties |
Build properties to configure on the repository. |
|
properties.contentDistributionEndpoint |
string |
The content distribution endpoint for the static site. |
properties.customDomains |
string[] |
The custom domains associated with this static site. |
properties.databaseConnections |
Database connections for the static site |
|
properties.defaultHostname |
string |
The default autogenerated hostname for the static site. |
properties.enterpriseGradeCdnStatus |
State indicating the status of the enterprise grade CDN serving traffic to the static web app. |
|
properties.keyVaultReferenceIdentity |
string |
Identity to use for Key Vault Reference authentication. |
properties.linkedBackends |
Backends linked to the static side |
|
properties.privateEndpointConnections |
Private endpoint connections |
|
properties.provider |
string |
The provider that submitted the last deployment to the primary environment of the static site. |
properties.publicNetworkAccess |
string |
State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. |
properties.repositoryToken |
string |
A user's github repository token. This is used to setup the Github Actions workflow file and API secrets. |
properties.repositoryUrl |
string |
URL for the repository of the static site. |
properties.stagingEnvironmentPolicy |
State indicating whether staging environments are allowed or not allowed for a static web app. |
|
properties.templateProperties |
Template options for generating a new repository. |
|
properties.userProvidedFunctionApps |
User provided function apps registered with the static site |
|
sku |
Description of a SKU for a scalable resource. |
|
tags |
object |
Resource tags. |
type |
string |
Resource type. |
StaticSiteBuildProperties
Build properties for the static site.
Name | Type | Description |
---|---|---|
apiBuildCommand |
string |
A custom command to run during deployment of the Azure Functions API application. |
apiLocation |
string |
The path to the api code within the repository. |
appArtifactLocation |
string |
Deprecated: The path of the app artifacts after building (deprecated in favor of OutputLocation) |
appBuildCommand |
string |
A custom command to run during deployment of the static content application. |
appLocation |
string |
The path to the app code within the repository. |
githubActionSecretNameOverride |
string |
Github Action secret name override. |
outputLocation |
string |
The output path of the app after building. |
skipGithubActionWorkflowGeneration |
boolean |
Skip Github Action workflow generation. |
StaticSiteDatabaseConnectionConfigurationFileOverview
A database connection configuration file
Name | Type | Description |
---|---|---|
contents |
string |
The Base64 encoding of the file contents. |
fileName |
string |
The name of the configuration file. |
type |
string |
The type of configuration file. |
StaticSiteLinkedBackend
Static Site Linked Backend ARM resource.
Name | Type | Description |
---|---|---|
backendResourceId |
string |
The resource id of the backend linked to the static site |
createdOn |
string (date-time) |
The date and time on which the backend was linked to the static site. |
provisioningState |
string |
The provisioning state of the linking process. |
region |
string |
The region of the backend linked to the static site |
StaticSiteTemplateOptions
Template Options for the static site.
Name | Type | Description |
---|---|---|
description |
string |
Description of the newly generated repository. |
isPrivate |
boolean |
Whether or not the newly generated repository is a private repository. Defaults to false (i.e. public). |
owner |
string |
Owner of the newly generated repository. |
repositoryName |
string |
Name of the newly generated repository. |
templateRepositoryUrl |
string |
URL of the template repository. The newly generated repository will be based on this one. |
StaticSiteUserProvidedFunctionApp
A static site user provided function.
Name | Type | Description |
---|---|---|
id |
string |
Resource Id. |
kind |
string |
Kind of resource. |
name |
string |
Resource Name. |
properties.createdOn |
string (date-time) |
The date and time on which the function app was registered with the static site. |
properties.functionAppRegion |
string |
The region of the function app registered with the static site |
properties.functionAppResourceId |
string |
The resource id of the function app registered with the static site |
type |
string |
Resource type. |
userAssignedIdentity
User Assigned identity.
Name | Type | Description |
---|---|---|
clientId |
string |
Client Id of user assigned identity |
principalId |
string |
Principal Id of user assigned identity |