0
# Account Management
1
2
Complete lifecycle management of Azure Maps accounts including creation, configuration, updates, and deletion. This module also handles authentication keys, SAS tokens, CORS configuration, encryption settings, and managed identities.
3
4
## Capabilities
5
6
### Account Creation and Updates
7
8
Create new Azure Maps accounts or update existing ones with full configuration options including SKU, location, identity, and properties.
9
10
```python { .api }
11
def create_or_update(
12
resource_group_name: str,
13
account_name: str,
14
maps_account: Union[MapsAccount, IO],
15
**kwargs
16
) -> MapsAccount:
17
"""
18
Create or update an Azure Maps account.
19
20
Args:
21
resource_group_name: Name of the resource group
22
account_name: Name of the Maps account
23
maps_account: Maps account object or JSON payload
24
25
Returns:
26
MapsAccount: The created or updated account
27
28
Raises:
29
HttpResponseError: If the request fails
30
"""
31
32
def update(
33
resource_group_name: str,
34
account_name: str,
35
maps_account_update_parameters: Union[MapsAccountUpdateParameters, IO],
36
**kwargs
37
) -> MapsAccount:
38
"""
39
Update an existing Azure Maps account.
40
41
Args:
42
resource_group_name: Name of the resource group
43
account_name: Name of the Maps account
44
maps_account_update_parameters: Update parameters
45
46
Returns:
47
MapsAccount: The updated account
48
"""
49
```
50
51
Usage example:
52
53
```python
54
from azure.mgmt.maps.models import (
55
MapsAccount, Sku, Kind, MapsAccountProperties,
56
CorsRules, CorsRule, ManagedServiceIdentity, ManagedServiceIdentityType
57
)
58
from typing import Union, IO
59
60
# Create account with Gen2 features
61
maps_account = MapsAccount(
62
location="eastus",
63
sku=Sku(name="S1"), # Standard tier
64
kind=Kind.GEN2,
65
properties=MapsAccountProperties(
66
disable_local_auth=False,
67
cors=CorsRules(cors_rules=[
68
CorsRule(
69
allowed_origins=["https://example.com"],
70
allowed_methods=["GET", "POST"],
71
allowed_headers=["*"],
72
max_age_in_seconds=3600
73
)
74
])
75
),
76
tags={"environment": "production", "team": "geo"}
77
)
78
79
account = client.accounts.create_or_update(
80
resource_group_name="my-rg",
81
account_name="my-maps-account",
82
maps_account=maps_account
83
)
84
```
85
86
### Account Deletion and Retrieval
87
88
Delete accounts or retrieve detailed information about existing accounts.
89
90
```python { .api }
91
def delete(resource_group_name: str, account_name: str, **kwargs) -> None:
92
"""
93
Delete an Azure Maps account.
94
95
Args:
96
resource_group_name: Name of the resource group
97
account_name: Name of the Maps account to delete
98
99
Raises:
100
HttpResponseError: If the request fails
101
"""
102
103
def get(resource_group_name: str, account_name: str, **kwargs) -> MapsAccount:
104
"""
105
Get details of an Azure Maps account.
106
107
Args:
108
resource_group_name: Name of the resource group
109
account_name: Name of the Maps account
110
111
Returns:
112
MapsAccount: The account details
113
"""
114
```
115
116
### Account Discovery
117
118
List and discover Maps accounts within resource groups or across subscriptions.
119
120
```python { .api }
121
def list_by_resource_group(resource_group_name: str, **kwargs) -> Iterable[MapsAccount]:
122
"""
123
List Maps accounts in a resource group.
124
125
Args:
126
resource_group_name: Name of the resource group
127
128
Returns:
129
Iterable[MapsAccount]: Iterator of Maps accounts
130
"""
131
132
def list_by_subscription(**kwargs) -> Iterable[MapsAccount]:
133
"""
134
List Maps accounts in the subscription.
135
136
Returns:
137
Iterable[MapsAccount]: Iterator of Maps accounts
138
"""
139
```
140
141
Usage example:
142
143
```python
144
# List all accounts in subscription
145
all_accounts = list(client.accounts.list_by_subscription())
146
147
# List accounts in specific resource group
148
rg_accounts = list(client.accounts.list_by_resource_group("my-rg"))
149
150
for account in all_accounts:
151
print(f"Account: {account.name} in {account.location}")
152
print(f"SKU: {account.sku.name}, Kind: {account.kind}")
153
```
154
155
### Authentication Key Management
156
157
Manage primary and secondary access keys for Maps accounts, including key regeneration.
158
159
```python { .api }
160
def list_keys(resource_group_name: str, account_name: str, **kwargs) -> MapsAccountKeys:
161
"""
162
Get the access keys for a Maps account.
163
164
Args:
165
resource_group_name: Name of the resource group
166
account_name: Name of the Maps account
167
168
Returns:
169
MapsAccountKeys: Object containing primary and secondary keys
170
"""
171
172
def regenerate_keys(
173
resource_group_name: str,
174
account_name: str,
175
key_specification: Union[MapsKeySpecification, IO],
176
**kwargs
177
) -> MapsAccountKeys:
178
"""
179
Regenerate access keys for a Maps account.
180
181
Args:
182
resource_group_name: Name of the resource group
183
account_name: Name of the Maps account
184
key_specification: Specification of which key to regenerate
185
186
Returns:
187
MapsAccountKeys: Object with the new keys
188
"""
189
```
190
191
Usage example:
192
193
```python
194
from azure.mgmt.maps.models import MapsKeySpecification, KeyType
195
196
# Get current keys
197
keys = client.accounts.list_keys("my-rg", "my-account")
198
print(f"Primary: {keys.primary_key}")
199
print(f"Secondary: {keys.secondary_key}")
200
print(f"Primary last updated: {keys.primary_key_last_updated}")
201
print(f"Secondary last updated: {keys.secondary_key_last_updated}")
202
203
# Regenerate primary key
204
key_spec = MapsKeySpecification(key_type=KeyType.PRIMARY)
205
new_keys = client.accounts.regenerate_keys(
206
"my-rg",
207
"my-account",
208
key_spec
209
)
210
print(f"New primary key: {new_keys.primary_key}")
211
```
212
213
### SAS Token Management
214
215
Generate Shared Access Signature (SAS) tokens for secure, time-limited access to Maps services.
216
217
```python { .api }
218
def list_sas(
219
resource_group_name: str,
220
account_name: str,
221
maps_account_sas_parameters: Union[AccountSasParameters, IO],
222
**kwargs
223
) -> MapsAccountSasToken:
224
"""
225
Create a SAS token for the Maps account.
226
227
Args:
228
resource_group_name: Name of the resource group
229
account_name: Name of the Maps account
230
maps_account_sas_parameters: SAS token parameters
231
232
Returns:
233
MapsAccountSasToken: Object containing the SAS token
234
"""
235
```
236
237
Usage example:
238
239
```python
240
from azure.mgmt.maps.models import AccountSasParameters, SigningKey
241
from datetime import datetime, timedelta
242
243
# Create SAS token valid for 24 hours
244
start_time = datetime.utcnow()
245
expiry_time = start_time + timedelta(hours=24)
246
247
sas_params = AccountSasParameters(
248
signing_key=SigningKey.PRIMARY_KEY,
249
principal_id="user-principal-id",
250
max_rate_per_second=500,
251
start=start_time.isoformat() + "Z",
252
expiry=expiry_time.isoformat() + "Z",
253
regions=["eastus", "westus2"]
254
)
255
256
sas_token = client.accounts.list_sas(
257
"my-rg",
258
"my-account",
259
sas_params
260
)
261
print(f"SAS Token: {sas_token.account_sas_token}")
262
```
263
264
## Account Configuration Types
265
266
### Core Account Properties
267
268
```python { .api }
269
class MapsAccount:
270
"""Complete Azure Maps account resource."""
271
# Azure resource properties
272
id: Optional[str] # Resource ID
273
name: Optional[str] # Account name
274
type: Optional[str] # Resource type
275
location: Optional[str] # Azure region
276
tags: Optional[Dict[str, str]] # Resource tags
277
278
# Maps-specific configuration
279
sku: Optional[Sku] # Pricing tier
280
kind: Optional[Union[str, Kind]] # Account generation
281
identity: Optional[ManagedServiceIdentity] # Managed identity
282
properties: Optional[MapsAccountProperties] # Account properties
283
system_data: Optional[SystemData] # System metadata
284
285
class MapsAccountProperties:
286
"""Detailed account properties and configuration."""
287
# Authentication settings
288
disable_local_auth: Optional[bool] # Disable key-based auth
289
290
# Network and security
291
cors: Optional[CorsRules] # CORS configuration
292
encryption: Optional[Encryption] # Encryption settings
293
linked_resources: Optional[List[LinkedResource]] # Linked resources
294
295
# Account metadata (read-only)
296
unique_id: Optional[str] # Unique account identifier
297
provisioning_state: Optional[str] # Provisioning status
298
299
class MapsAccountUpdateParameters:
300
"""Parameters for updating Maps accounts."""
301
identity: Optional[ManagedServiceIdentity]
302
properties: Optional[MapsAccountProperties]
303
sku: Optional[Sku]
304
tags: Optional[Dict[str, str]]
305
```
306
307
### SKU and Pricing
308
309
```python { .api }
310
class Sku:
311
"""Maps account pricing tier configuration."""
312
name: Union[str, Name] # SKU name (S0, S1, G2)
313
tier: Optional[str] # Pricing tier
314
315
class Name(str, Enum):
316
"""Available SKU names."""
317
S0 = "S0" # Free tier
318
S1 = "S1" # Standard tier
319
G2 = "G2" # Gen2 tier
320
```
321
322
### Security and Identity
323
324
```python { .api }
325
class ManagedServiceIdentity:
326
"""Managed identity configuration."""
327
type: Optional[Union[str, ManagedServiceIdentityType]]
328
user_assigned_identities: Optional[Dict[str, UserAssignedIdentity]]
329
principal_id: Optional[str] # Read-only
330
tenant_id: Optional[str] # Read-only
331
332
class Encryption:
333
"""Account encryption configuration."""
334
customer_managed_key_encryption: Optional[CustomerManagedKeyEncryption]
335
infrastructure_encryption: Optional[Union[str, InfrastructureEncryption]]
336
337
class CorsRules:
338
"""CORS configuration for web applications."""
339
cors_rules: Optional[List[CorsRule]]
340
341
class CorsRule:
342
"""Individual CORS rule."""
343
allowed_origins: List[str] # Required: Allowed origin domains or "*" for all
344
```