你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Grafana - Create

为 Grafana 资源创建或更新工作区。 此 API 是幂等的,因此用户可以创建新的 grafana 或更新现有的 grafana。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}?api-version=2024-10-01

URI 参数

名称 必需 类型 说明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 名称不区分大小写。

subscriptionId
path True

string

minLength: 1

目标订阅的 ID。

workspaceName
path True

string

pattern: ^[a-zA-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]$

Azure 托管 Grafana 的工作区名称。

api-version
query True

string

minLength: 1

用于此操作的 API 版本。

请求正文

名称 类型 说明
identity

ManagedServiceIdentity

grafana 资源的托管标识。

location

string

grafana 资源所在的地理位置

properties

ManagedGrafanaProperties

特定于 grafana 资源的属性。

sku

ResourceSku

grafana 资源的 SKU。

tags

object

grafana 资源的标记。

响应

名称 类型 说明
200 OK

ManagedGrafana

还行。 已成功为 Grafana 资源创建工作区。

201 Created

ManagedGrafana

创建已启动。 操作已成功启动,并且将以异步方式完成。

标头

Azure-AsyncOperation: string

Other Status Codes

ErrorResponse

所有 Azure 资源管理器 API 的常见错误响应,以返回失败操作的错误详细信息。

示例

Grafana_Create

示例请求

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Dashboard/grafana/myWorkspace?api-version=2024-10-01

{
  "sku": {
    "name": "Standard"
  },
  "properties": {
    "publicNetworkAccess": "Enabled",
    "zoneRedundancy": "Enabled",
    "apiKey": "Enabled",
    "deterministicOutboundIP": "Enabled",
    "grafanaConfigurations": {
      "smtp": {
        "enabled": true,
        "host": "smtp.sendemail.com:587",
        "user": "username",
        "password": "<password>",
        "fromAddress": "test@sendemail.com",
        "fromName": "emailsender",
        "startTLSPolicy": "OpportunisticStartTLS",
        "skipVerify": true
      },
      "snapshots": {
        "externalEnabled": true
      },
      "users": {
        "viewersCanEdit": true
      },
      "security": {
        "csrfAlwaysCheck": false
      }
    },
    "grafanaIntegrations": {
      "azureMonitorWorkspaceIntegrations": [
        {
          "azureMonitorWorkspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
        }
      ]
    },
    "enterpriseConfigurations": {
      "marketplacePlanId": "myPlanId",
      "marketplaceAutoRenew": "Enabled"
    },
    "grafanaPlugins": {
      "sample-plugin-id": {}
    },
    "grafanaMajorVersion": "9"
  },
  "identity": {
    "type": "SystemAssigned"
  },
  "tags": {
    "Environment": "Dev"
  },
  "location": "West US"
}

示例响应

{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace",
  "name": "myWorkspace",
  "type": "Microsoft.Dashboard/grafana",
  "sku": {
    "name": "Standard"
  },
  "properties": {
    "provisioningState": "Succeeded",
    "grafanaVersion": "9.4.5",
    "endpoint": "https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com",
    "zoneRedundancy": "Enabled",
    "apiKey": "Enabled",
    "deterministicOutboundIP": "Enabled",
    "outboundIPs": [
      "192.168.0.1",
      "192.168.0.2"
    ],
    "publicNetworkAccess": "Enabled",
    "autoGeneratedDomainNameLabelScope": "TenantReuse",
    "grafanaConfigurations": {
      "smtp": {
        "enabled": true,
        "host": "smtp.sendemail.com:587",
        "user": "username",
        "fromAddress": "test@sendemail.com",
        "fromName": "emailsender",
        "startTLSPolicy": "OpportunisticStartTLS",
        "skipVerify": true
      },
      "snapshots": {
        "externalEnabled": true
      },
      "users": {
        "viewersCanEdit": true
      },
      "security": {
        "csrfAlwaysCheck": false
      }
    },
    "grafanaIntegrations": {
      "azureMonitorWorkspaceIntegrations": [
        {
          "azureMonitorWorkspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
        }
      ]
    },
    "enterpriseConfigurations": {
      "marketplacePlanId": "myPlanId",
      "marketplaceAutoRenew": "Enabled"
    },
    "grafanaPlugins": {
      "sample-plugin-id": {
        "pluginId": "sample-plugin-id"
      }
    },
    "grafanaMajorVersion": "9"
  },
  "identity": {
    "type": "SystemAssigned"
  },
  "tags": {
    "Environment": "Dev"
  },
  "location": "West US",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2020-02-03T01:01:01.1075056Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2020-02-04T02:03:01.1974346Z"
  }
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Dashboard/locations/eastus2/operationStatuses/sample-op-status?api-version=2024-10-01
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/grafana/myWorkspace",
  "name": "myWorkspace",
  "type": "Microsoft.Dashboard/grafana",
  "sku": {
    "name": "Standard"
  },
  "properties": {
    "provisioningState": "Accepted",
    "grafanaVersion": "9.4.5",
    "endpoint": "https://myworkspace-abcdefghijklmnop.wus.grafana.azure.com",
    "zoneRedundancy": "Enabled",
    "apiKey": "Enabled",
    "deterministicOutboundIP": "Enabled",
    "publicNetworkAccess": "Enabled",
    "autoGeneratedDomainNameLabelScope": "TenantReuse",
    "grafanaConfigurations": {
      "smtp": {
        "enabled": true,
        "host": "smtp.sendemail.com:587",
        "user": "username",
        "fromAddress": "test@sendemail.com",
        "fromName": "emailsender",
        "startTLSPolicy": "OpportunisticStartTLS",
        "skipVerify": true
      },
      "snapshots": {
        "externalEnabled": true
      },
      "users": {
        "viewersCanEdit": true
      },
      "security": {
        "csrfAlwaysCheck": false
      }
    },
    "grafanaIntegrations": {
      "azureMonitorWorkspaceIntegrations": [
        {
          "azureMonitorWorkspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"
        }
      ]
    },
    "grafanaMajorVersion": "9"
  },
  "tags": {
    "Environment": "Dev"
  },
  "location": "West US",
  "systemData": {
    "createdBy": "string",
    "createdByType": "User",
    "createdAt": "2020-02-03T01:01:01.1075056Z",
    "lastModifiedBy": "string",
    "lastModifiedByType": "User",
    "lastModifiedAt": "2020-02-04T02:03:01.1974346Z"
  }
}

定义

名称 说明
ApiKey
AutoGeneratedDomainNameLabelScope

dns 确定性名称哈希计算的范围

AzureMonitorWorkspaceIntegration

Azure Monitor 工作区的集成。

createdByType

创建资源的标识的类型。

DeterministicOutboundIP
EnterpriseConfigurations

Grafana 实例的企业设置

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

GrafanaConfigurations

Grafana 实例的服务器配置

GrafanaIntegrations

GrafanaIntegrations 是捆绑的可观测性体验(例如预先配置的数据源、定制的 Grafana 仪表板、警报默认值),适用于常见监视方案。

GrafanaPlugin

Grafana 插件

ManagedGrafana

grafana 资源类型。

ManagedGrafanaProperties

特定于 grafana 资源的属性。

ManagedServiceIdentity

托管服务标识(系统分配和/或用户分配的标识)

ManagedServiceIdentityType

托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。

MarketplaceAutoRenew

企业订阅的 AutoRenew 设置

PrivateEndpoint

专用终结点资源。

PrivateEndpointConnection

专用终结点连接资源。

PrivateEndpointConnectionProvisioningState

当前预配状态。

PrivateEndpointServiceConnectionStatus

专用终结点连接状态。

PrivateLinkServiceConnectionState

有关服务使用者与提供程序之间的连接状态的信息集合。

ProvisioningState
PublicNetworkAccess

指示通过公共接口启用或禁用流量的状态。

ResourceSku
Security

Grafana 安全设置

Smtp

电子邮件服务器设置。 https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp

Snapshots

Grafana 快照设置

StartTLSPolicy

SMTP 配置 https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy 的 StartTLSPolicy 设置

systemData

与创建和上次修改资源相关的元数据。

UserAssignedIdentity

用户分配的标识属性

Users

Grafana 用户设置

ZoneRedundancy

ApiKey

说明
Disabled
Enabled

AutoGeneratedDomainNameLabelScope

dns 确定性名称哈希计算的范围

说明
TenantReuse

AzureMonitorWorkspaceIntegration

Azure Monitor 工作区的集成。

名称 类型 说明
azureMonitorWorkspaceResourceId

string

连接的 Azure Monitor 工作区的资源 ID。

createdByType

创建资源的标识的类型。

说明
Application
Key
ManagedIdentity
User

DeterministicOutboundIP

说明
Disabled
Enabled

EnterpriseConfigurations

Grafana 实例的企业设置

名称 类型 说明
marketplaceAutoRenew

MarketplaceAutoRenew

企业订阅的 AutoRenew 设置

marketplacePlanId

string

企业插件的 Azure 市场订阅的计划 ID

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

GrafanaConfigurations

Grafana 实例的服务器配置

名称 类型 说明
security

Security

Grafana 安全设置

smtp

Smtp

电子邮件服务器设置。 https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp

snapshots

Snapshots

Grafana 快照设置

users

Users

Grafana 用户设置

GrafanaIntegrations

GrafanaIntegrations 是捆绑的可观测性体验(例如预先配置的数据源、定制的 Grafana 仪表板、警报默认值),适用于常见监视方案。

名称 类型 说明
azureMonitorWorkspaceIntegrations

AzureMonitorWorkspaceIntegration[]

Azure Monitor 工作区的集成。

GrafanaPlugin

Grafana 插件

名称 类型 说明
pluginId

string

Grafana 插件 ID

ManagedGrafana

grafana 资源类型。

名称 类型 说明
id

string

grafana 资源的 ARM ID

identity

ManagedServiceIdentity

grafana 资源的托管标识。

location

string

grafana 资源所在的地理位置

name

string

grafana 资源的名称。

properties

ManagedGrafanaProperties

特定于 grafana 资源的属性。

sku

ResourceSku

grafana 资源的 SKU。

systemData

systemData

与此 grafana 资源相关的系统元数据。

tags

object

grafana 资源的标记。

type

string

grafana 资源的类型。

ManagedGrafanaProperties

特定于 grafana 资源的属性。

名称 类型 默认值 说明
apiKey

ApiKey

Disabled

Grafana 实例的 API 密钥设置。

autoGeneratedDomainNameLabelScope

AutoGeneratedDomainNameLabelScope

dns 确定性名称哈希计算的范围。

deterministicOutboundIP

DeterministicOutboundIP

Disabled

Grafana 实例是否使用确定性的出站 IP。

endpoint

string

Grafana 实例的终结点。

enterpriseConfigurations

EnterpriseConfigurations

Grafana 实例的企业设置

grafanaConfigurations

GrafanaConfigurations

Grafana 实例的服务器配置

grafanaIntegrations

GrafanaIntegrations

GrafanaIntegrations 是捆绑的可观测性体验(例如预先配置的数据源、定制的 Grafana 仪表板、警报默认值),适用于常见监视方案。

grafanaMajorVersion

string

要面向的主要 Grafana 软件版本。

grafanaPlugins

<string,  GrafanaPlugin>

Grafana 实例的已安装插件列表。 键为插件 ID,值为插件定义。

grafanaVersion

string

Grafana 软件版本。

outboundIPs

string[]

如果已启用 deterministicOutboundIP,则列出出站 IP。

privateEndpointConnections

PrivateEndpointConnection[]

Grafana 实例的专用终结点连接。

provisioningState

ProvisioningState

资源的预配状态。

publicNetworkAccess

PublicNetworkAccess

Enabled

指示通过公共接口启用或禁用流量的状态。

zoneRedundancy

ZoneRedundancy

Disabled

Grafana 实例的区域冗余设置。

ManagedServiceIdentity

托管服务标识(系统分配和/或用户分配的标识)

名称 类型 说明
principalId

string (uuid)

系统分配标识的服务主体 ID。 此属性仅针对系统分配的标识提供。

tenantId

string (uuid)

系统分配标识的租户 ID。 此属性仅针对系统分配的标识提供。

type

ManagedServiceIdentityType

托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。

userAssignedIdentities

<string,  UserAssignedIdentity>

User-Assigned 标识
与资源关联的用户分配标识集。 userAssignedIdentities 字典密钥将为 ARM 资源 ID,格式为“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 字典值可以是请求中的空对象({})。

ManagedServiceIdentityType

托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。

说明
None
SystemAssigned
SystemAssigned,UserAssigned
UserAssigned

MarketplaceAutoRenew

企业订阅的 AutoRenew 设置

说明
Disabled
Enabled

PrivateEndpoint

专用终结点资源。

名称 类型 说明
id

string

专用终结点的 ARM 标识符

PrivateEndpointConnection

专用终结点连接资源。

名称 类型 说明
id

string

资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

资源的名称

properties.groupIds

string[]

专用终结点连接组 ID。

properties.privateEndpoint

PrivateEndpoint

专用终结点的资源。

properties.privateLinkServiceConnectionState

PrivateLinkServiceConnectionState

有关服务使用者与提供程序之间的连接状态的信息集合。

properties.provisioningState

PrivateEndpointConnectionProvisioningState

专用终结点连接资源的预配状态。

systemData

systemData

包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。

type

string

资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

PrivateEndpointConnectionProvisioningState

当前预配状态。

说明
Creating
Deleting
Failed
Succeeded

PrivateEndpointServiceConnectionStatus

专用终结点连接状态。

说明
Approved
Pending
Rejected

PrivateLinkServiceConnectionState

有关服务使用者与提供程序之间的连接状态的信息集合。

名称 类型 说明
actionsRequired

string

一条消息,指示服务提供商上的更改是否需要对使用者进行任何更新。

description

string

批准/拒绝连接的原因。

status

PrivateEndpointServiceConnectionStatus

指示连接是否已被服务的所有者批准/拒绝/删除。

ProvisioningState

说明
Accepted
Canceled
Creating
Deleted
Deleting
Failed
NotSpecified
Succeeded
Updating

PublicNetworkAccess

指示通过公共接口启用或禁用流量的状态。

说明
Disabled
Enabled

ResourceSku

名称 类型 说明
name

string

Security

Grafana 安全设置

名称 类型 说明
csrfAlwaysCheck

boolean

设置为 true 以执行 CSRF 检查,即使登录 Cookie 不在请求中(默认值 false)。

Smtp

电子邮件服务器设置。 https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp

名称 类型 默认值 说明
enabled

boolean

False

启用此选项以允许 Grafana 发送电子邮件。 默认值为 false

fromAddress

string

发送电子邮件时使用的地址 https://pkg.go.dev/net/mail#Address

fromName

string

发送电子邮件时要使用的名称。 默认值为“Azure 托管 Grafana 通知”https://pkg.go.dev/net/mail#Address

host

string

具有端口的 SMTP 服务器主机名,例如 test.email.net:587

password

string

SMTP 身份验证的密码。如果密码包含 # 或 ;,则必须用三引号包装它

skipVerify

boolean

验证 SMTP 服务器的 SSL。 默认值为 false https://pkg.go.dev/crypto/tls#Config

startTLSPolicy

StartTLSPolicy

SMTP 配置 https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy 的 StartTLSPolicy 设置

user

string

SMTP 身份验证的用户

Snapshots

Grafana 快照设置

名称 类型 说明
externalEnabled

boolean

设置为 false 以禁用外部快照发布终结点

StartTLSPolicy

SMTP 配置 https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy 的 StartTLSPolicy 设置

说明
MandatoryStartTLS
NoStartTLS
OpportunisticStartTLS

systemData

与创建和上次修改资源相关的元数据。

名称 类型 说明
createdAt

string (date-time)

资源创建时间戳(UTC)。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识的类型。

lastModifiedAt

string (date-time)

上次修改的资源时间戳(UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识的类型。

UserAssignedIdentity

用户分配的标识属性

名称 类型 说明
clientId

string (uuid)

分配的标识的客户端 ID。

principalId

string (uuid)

已分配标识的主体 ID。

Users

Grafana 用户设置

名称 类型 说明
viewersCanEdit

boolean

设置为 true,以便查看者可以访问和使用浏览并在他们有权访问的仪表板中的面板上执行临时编辑。 他们无法保存更改。

ZoneRedundancy

说明
Disabled
Enabled