1717class Create (AAZCommand ):
1818 """Create a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana.
1919
20- :example: create Azure Managed Grafana resource with Standard Sku and public network access enabled
21- az grafana create --resource-group myResourceGroup --workspace-name myWorkspace --sku-tier Standard -- public-network-access Enabled
20+ :example: create Azure Managed Grafana resource with public network access enabled
21+ az grafana create --resource-group myResourceGroup --workspace-name myWorkspace --public-network-access Enabled
2222 """
2323
2424 _aaz_info = {
25- "version" : "2023-09 -01" ,
25+ "version" : "2024-11 -01-preview " ,
2626 "resources" : [
27- ["mgmt-plane" , "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dashboard/grafana/{}" , "2023-09 -01" ],
27+ ["mgmt-plane" , "/subscriptions/{}/resourcegroups/{}/providers/microsoft.dashboard/grafana/{}" , "2024-11 -01-preview " ],
2828 ]
2929 }
3030
@@ -52,6 +52,9 @@ def _build_arguments_schema(cls, *args, **kwargs):
5252 options = ["-n" , "--name" , "--workspace-name" ],
5353 help = "The workspace name of Azure Managed Grafana." ,
5454 required = True ,
55+ fmt = AAZStrArgFormat (
56+ pattern = "^[a-zA-Z][a-z0-9A-Z-]{0,28}[a-z0-9A-Z]$" ,
57+ ),
5558 )
5659 _args_schema .identity = AAZObjectArg (
5760 options = ["--identity" ],
@@ -69,17 +72,30 @@ def _build_arguments_schema(cls, *args, **kwargs):
6972 )
7073
7174 identity = cls ._args_schema .identity
75+ identity .mi_system_assigned = AAZStrArg (
76+ options = ["system-assigned" , "mi-system-assigned" ],
77+ help = "Set the system managed identity." ,
78+ blank = "True" ,
79+ )
7280 identity .type = AAZStrArg (
7381 options = ["type" ],
7482 help = "Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed)." ,
7583 required = True ,
7684 enum = {"None" : "None" , "SystemAssigned" : "SystemAssigned" , "SystemAssigned,UserAssigned" : "SystemAssigned,UserAssigned" , "UserAssigned" : "UserAssigned" },
7785 )
86+ identity .mi_user_assigned = AAZListArg (
87+ options = ["user-assigned" , "mi-user-assigned" ],
88+ help = "Set the user managed identities." ,
89+ blank = [],
90+ )
7891 identity .user_assigned_identities = AAZDictArg (
7992 options = ["user-assigned-identities" ],
8093 help = "The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests." ,
8194 )
8295
96+ mi_user_assigned = cls ._args_schema .identity .mi_user_assigned
97+ mi_user_assigned .Element = AAZStrArg ()
98+
8399 user_assigned_identities = cls ._args_schema .identity .user_assigned_identities
84100 user_assigned_identities .Element = AAZObjectArg (
85101 blank = {},
@@ -92,7 +108,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
92108
93109 _args_schema = cls ._args_schema
94110 _args_schema .service_account = AAZStrArg (
95- options = ["--api-key" , "-- service-account" ],
111+ options = ["--service-account" ],
96112 arg_group = "Properties" ,
97113 help = "The api key setting of the Grafana instance." ,
98114 default = "Disabled" ,
@@ -124,12 +140,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
124140 default = "Disabled" ,
125141 enum = {"Disabled" : "Disabled" , "Enabled" : "Enabled" },
126142 )
127- _args_schema .sku_tier = AAZStrArg (
128- options = ["--sku-tier" ],
129- arg_group = "Properties" ,
130- help = "The Sku of the grafana resource." ,
131- default = "Standard" ,
132- )
133143 return cls ._args_schema
134144
135145 def _execute_operations (self ):
@@ -213,7 +223,7 @@ def url_parameters(self):
213223 def query_parameters (self ):
214224 parameters = {
215225 ** self .serialize_query_param (
216- "api-version" , "2023-09 -01" ,
226+ "api-version" , "2024-11 -01-preview " ,
217227 required = True ,
218228 ),
219229 }
@@ -238,7 +248,7 @@ def content(self):
238248 typ = AAZObjectType ,
239249 typ_kwargs = {"flags" : {"required" : True , "client_flatten" : True }}
240250 )
241- _builder .set_prop ("identity" , AAZObjectType , ".identity" )
251+ _builder .set_prop ("identity" , AAZIdentityObjectType , ".identity" )
242252 _builder .set_prop ("location" , AAZStrType , ".location" )
243253 _builder .set_prop ("properties" , AAZObjectType )
244254 _builder .set_prop ("sku" , AAZObjectType )
@@ -248,11 +258,17 @@ def content(self):
248258 if identity is not None :
249259 identity .set_prop ("type" , AAZStrType , ".type" , typ_kwargs = {"flags" : {"required" : True }})
250260 identity .set_prop ("userAssignedIdentities" , AAZDictType , ".user_assigned_identities" )
261+ identity .set_prop ("userAssigned" , AAZListType , ".mi_user_assigned" , typ_kwargs = {"flags" : {"action" : "create" }})
262+ identity .set_prop ("systemAssigned" , AAZStrType , ".mi_system_assigned" , typ_kwargs = {"flags" : {"action" : "create" }})
251263
252264 user_assigned_identities = _builder .get (".identity.userAssignedIdentities" )
253265 if user_assigned_identities is not None :
254266 user_assigned_identities .set_elements (AAZObjectType , "." )
255267
268+ user_assigned = _builder .get (".identity.userAssigned" )
269+ if user_assigned is not None :
270+ user_assigned .set_elements (AAZStrType , "." )
271+
256272 properties = _builder .get (".properties" )
257273 if properties is not None :
258274 properties .set_prop ("apiKey" , AAZStrType , ".service_account" )
@@ -261,10 +277,6 @@ def content(self):
261277 properties .set_prop ("publicNetworkAccess" , AAZStrType , ".public_network_access" )
262278 properties .set_prop ("zoneRedundancy" , AAZStrType , ".zone_redundancy" )
263279
264- sku = _builder .get (".sku" )
265- if sku is not None :
266- sku .set_prop ("name" , AAZStrType , ".sku_tier" , typ_kwargs = {"flags" : {"required" : True }})
267-
268280 tags = _builder .get (".tags" )
269281 if tags is not None :
270282 tags .set_elements (AAZStrType , "." )
@@ -292,7 +304,7 @@ def _build_schema_on_200_201(cls):
292304 _schema_on_200_201 .id = AAZStrType (
293305 flags = {"read_only" : True },
294306 )
295- _schema_on_200_201 .identity = AAZObjectType ()
307+ _schema_on_200_201 .identity = AAZIdentityObjectType ()
296308 _schema_on_200_201 .location = AAZStrType ()
297309 _schema_on_200_201 .name = AAZStrType (
298310 flags = {"read_only" : True },
@@ -398,7 +410,18 @@ def _build_schema_on_200_201(cls):
398410 )
399411
400412 grafana_configurations = cls ._schema_on_200_201 .properties .grafana_configurations
413+ grafana_configurations .security = AAZObjectType ()
401414 grafana_configurations .smtp = AAZObjectType ()
415+ grafana_configurations .snapshots = AAZObjectType ()
416+ grafana_configurations .unified_alerting_screenshots = AAZObjectType (
417+ serialized_name = "unifiedAlertingScreenshots" ,
418+ )
419+ grafana_configurations .users = AAZObjectType ()
420+
421+ security = cls ._schema_on_200_201 .properties .grafana_configurations .security
422+ security .csrf_always_check = AAZBoolType (
423+ serialized_name = "csrfAlwaysCheck" ,
424+ )
402425
403426 smtp = cls ._schema_on_200_201 .properties .grafana_configurations .smtp
404427 smtp .enabled = AAZBoolType ()
@@ -420,6 +443,24 @@ def _build_schema_on_200_201(cls):
420443 )
421444 smtp .user = AAZStrType ()
422445
446+ snapshots = cls ._schema_on_200_201 .properties .grafana_configurations .snapshots
447+ snapshots .external_enabled = AAZBoolType (
448+ serialized_name = "externalEnabled" ,
449+ )
450+
451+ unified_alerting_screenshots = cls ._schema_on_200_201 .properties .grafana_configurations .unified_alerting_screenshots
452+ unified_alerting_screenshots .capture_enabled = AAZBoolType (
453+ serialized_name = "captureEnabled" ,
454+ )
455+
456+ users = cls ._schema_on_200_201 .properties .grafana_configurations .users
457+ users .editors_can_admin = AAZBoolType (
458+ serialized_name = "editorsCanAdmin" ,
459+ )
460+ users .viewers_can_edit = AAZBoolType (
461+ serialized_name = "viewersCanEdit" ,
462+ )
463+
423464 grafana_integrations = cls ._schema_on_200_201 .properties .grafana_integrations
424465 grafana_integrations .azure_monitor_workspace_integrations = AAZListType (
425466 serialized_name = "azureMonitorWorkspaceIntegrations" ,
0 commit comments