or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

blob-storage.mdfile-storage.mdindex.mdpolicy-management.mdqueue-storage.mdsecurity-access.mdstorage-accounts.mdstorage-tasks.mdtable-storage.mdutilities.md

storage-accounts.mddocs/

0

# Storage Account Management

1

2

Complete lifecycle management of Azure Storage accounts including creation, deletion, configuration updates, key management, and failover operations. Storage accounts are the fundamental resource containing all Azure Storage data services.

3

4

## Capabilities

5

6

### Name Availability Checking

7

8

Validates storage account names before creation to ensure they are available and meet naming requirements.

9

10

```python { .api }

11

def check_name_availability(

12

self,

13

account_name: StorageAccountCheckNameAvailabilityParameters

14

) -> CheckNameAvailabilityResult:

15

"""

16

Checks that the storage account name is valid and is not already in use.

17

18

Parameters:

19

- account_name: Name validation parameters containing the proposed name

20

21

Returns:

22

CheckNameAvailabilityResult with availability status and reason if unavailable

23

24

Raises:

25

HttpResponseError: For service errors

26

"""

27

```

28

29

Usage example:

30

31

```python

32

from azure.mgmt.storage.models import StorageAccountCheckNameAvailabilityParameters

33

34

check_params = StorageAccountCheckNameAvailabilityParameters(

35

name="mystorageaccount123",

36

type_="Microsoft.Storage/storageAccounts"

37

)

38

39

result = client.storage_accounts.check_name_availability(check_params)

40

if result.name_available:

41

print("Name is available")

42

else:

43

print(f"Name unavailable: {result.reason} - {result.message}")

44

```

45

46

### Storage Account Creation

47

48

Creates new storage accounts with comprehensive configuration options.

49

50

```python { .api }

51

def begin_create(

52

self,

53

resource_group_name: str,

54

account_name: str,

55

parameters: StorageAccountCreateParameters

56

) -> LROPoller[StorageAccount]:

57

"""

58

Creates a new storage account with the specified parameters.

59

60

Parameters:

61

- resource_group_name: Name of the resource group

62

- account_name: Name of the storage account (3-24 chars, lowercase letters and numbers)

63

- parameters: Storage account creation parameters

64

65

Returns:

66

LROPoller for tracking the long-running operation, result is StorageAccount

67

68

Raises:

69

HttpResponseError: For service errors including name conflicts

70

"""

71

```

72

73

Usage example:

74

75

```python

76

from azure.mgmt.storage.models import (

77

StorageAccountCreateParameters, Sku, Kind,

78

Identity, IdentityType, AccessTier

79

)

80

81

# Create with basic configuration

82

basic_params = StorageAccountCreateParameters(

83

sku=Sku(name="Standard_LRS"),

84

kind=Kind.STORAGE_V2,

85

location="East US",

86

access_tier=AccessTier.HOT

87

)

88

89

poller = client.storage_accounts.begin_create(

90

resource_group_name="my-resource-group",

91

account_name="mystorageaccount123",

92

parameters=basic_params

93

)

94

95

account = poller.result() # Wait for completion

96

print(f"Created account: {account.name}")

97

98

# Create with advanced configuration

99

advanced_params = StorageAccountCreateParameters(

100

sku=Sku(name="Standard_GRS"),

101

kind=Kind.STORAGE_V2,

102

location="West US 2",

103

access_tier=AccessTier.HOT,

104

identity=Identity(type=IdentityType.SYSTEM_ASSIGNED),

105

tags={"Environment": "Production", "Owner": "DataTeam"},

106

properties=StorageAccountPropertiesCreateParameters(

107

allow_blob_public_access=False,

108

minimum_tls_version="TLS1_2",

109

enable_https_traffic_only=True

110

)

111

)

112

```

113

114

### Storage Account Retrieval and Listing

115

116

Get individual storage accounts or list all accounts in subscription or resource group.

117

118

```python { .api }

119

def get_properties(

120

self,

121

resource_group_name: str,

122

account_name: str,

123

expand: Optional[StorageAccountExpand] = None

124

) -> StorageAccount:

125

"""

126

Returns the properties for the specified storage account.

127

128

Parameters:

129

- resource_group_name: Name of the resource group

130

- account_name: Name of the storage account

131

- expand: May be used to expand nested properties

132

133

Returns:

134

StorageAccount with full properties

135

136

Raises:

137

ResourceNotFoundError: If account doesn't exist

138

HttpResponseError: For other service errors

139

"""

140

141

def list(self) -> ItemPaged[StorageAccount]:

142

"""

143

Lists all storage accounts in the subscription.

144

145

Returns:

146

Paginated list of StorageAccount objects

147

"""

148

149

def list_by_resource_group(

150

self,

151

resource_group_name: str

152

) -> ItemPaged[StorageAccount]:

153

"""

154

Lists storage accounts in the specified resource group.

155

156

Parameters:

157

- resource_group_name: Name of the resource group

158

159

Returns:

160

Paginated list of StorageAccount objects

161

"""

162

```

163

164

Usage example:

165

166

```python

167

# Get specific account

168

account = client.storage_accounts.get_properties(

169

resource_group_name="my-resource-group",

170

account_name="mystorageaccount123"

171

)

172

print(f"Account kind: {account.kind}, SKU: {account.sku.name}")

173

174

# List all accounts in subscription

175

all_accounts = list(client.storage_accounts.list())

176

print(f"Total accounts: {len(all_accounts)}")

177

178

# List accounts in resource group

179

rg_accounts = list(client.storage_accounts.list_by_resource_group("my-resource-group"))

180

for account in rg_accounts:

181

print(f"Account: {account.name}, Location: {account.location}")

182

```

183

184

### Storage Account Updates

185

186

Update existing storage account properties and configuration.

187

188

```python { .api }

189

def update(

190

self,

191

resource_group_name: str,

192

account_name: str,

193

parameters: StorageAccountUpdateParameters

194

) -> StorageAccount:

195

"""

196

Updates the specified storage account with the provided parameters.

197

198

Parameters:

199

- resource_group_name: Name of the resource group

200

- account_name: Name of the storage account

201

- parameters: Storage account update parameters

202

203

Returns:

204

Updated StorageAccount

205

206

Raises:

207

ResourceNotFoundError: If account doesn't exist

208

HttpResponseError: For service errors

209

"""

210

```

211

212

Usage example:

213

214

```python

215

from azure.mgmt.storage.models import StorageAccountUpdateParameters

216

217

update_params = StorageAccountUpdateParameters(

218

access_tier=AccessTier.COOL,

219

tags={"Environment": "Development"},

220

properties=StorageAccountPropertiesUpdateParameters(

221

allow_blob_public_access=True,

222

minimum_tls_version="TLS1_2"

223

)

224

)

225

226

updated_account = client.storage_accounts.update(

227

resource_group_name="my-resource-group",

228

account_name="mystorageaccount123",

229

parameters=update_params

230

)

231

```

232

233

### Key Management

234

235

Manage access keys for storage account authentication.

236

237

```python { .api }

238

def list_keys(

239

self,

240

resource_group_name: str,

241

account_name: str,

242

expand: Literal["kerb"] = "kerb"

243

) -> StorageAccountListKeysResult:

244

"""

245

Lists the access keys for the specified storage account.

246

247

Parameters:

248

- resource_group_name: Name of the resource group

249

- account_name: Name of the storage account

250

- expand: May be used to expand nested properties

251

252

Returns:

253

StorageAccountListKeysResult containing access keys

254

"""

255

256

def regenerate_key(

257

self,

258

resource_group_name: str,

259

account_name: str,

260

regenerate_key: StorageAccountRegenerateKeyParameters

261

) -> StorageAccountListKeysResult:

262

"""

263

Regenerates the access keys for the specified storage account.

264

265

Parameters:

266

- resource_group_name: Name of the resource group

267

- account_name: Name of the storage account

268

- regenerate_key: Parameters specifying which key to regenerate

269

270

Returns:

271

StorageAccountListKeysResult with new keys

272

"""

273

```

274

275

Usage example:

276

277

```python

278

from azure.mgmt.storage.models import StorageAccountRegenerateKeyParameters

279

280

# List current keys

281

keys_result = client.storage_accounts.list_keys(

282

resource_group_name="my-resource-group",

283

account_name="mystorageaccount123"

284

)

285

286

for key in keys_result.keys:

287

print(f"Key name: {key.key_name}, Permissions: {key.permissions}")

288

289

# Regenerate a key

290

regenerate_params = StorageAccountRegenerateKeyParameters(key_name="key1")

291

new_keys = client.storage_accounts.regenerate_key(

292

resource_group_name="my-resource-group",

293

account_name="mystorageaccount123",

294

regenerate_key=regenerate_params

295

)

296

```

297

298

### SAS Token Generation

299

300

Generate account-level and service-level Shared Access Signatures.

301

302

```python { .api }

303

def list_account_sas(

304

self,

305

resource_group_name: str,

306

account_name: str,

307

parameters: AccountSasParameters

308

) -> ListAccountSasResponse:

309

"""

310

Lists SAS credentials for storage account.

311

312

Parameters:

313

- resource_group_name: Name of the resource group

314

- account_name: Name of the storage account

315

- parameters: SAS generation parameters

316

317

Returns:

318

ListAccountSasResponse containing the SAS token

319

"""

320

321

def list_service_sas(

322

self,

323

resource_group_name: str,

324

account_name: str,

325

parameters: ServiceSasParameters

326

) -> ListServiceSasResponse:

327

"""

328

Lists service SAS credentials for specific resource.

329

330

Parameters:

331

- resource_group_name: Name of the resource group

332

- account_name: Name of the storage account

333

- parameters: Service SAS parameters

334

335

Returns:

336

ListServiceSasResponse containing the SAS token

337

"""

338

```

339

340

### Account Deletion

341

342

Delete storage accounts with data removal.

343

344

```python { .api }

345

def delete(

346

self,

347

resource_group_name: str,

348

account_name: str

349

) -> None:

350

"""

351

Deletes a storage account. All data in the account is permanently deleted.

352

353

Parameters:

354

- resource_group_name: Name of the resource group

355

- account_name: Name of the storage account

356

357

Raises:

358

ResourceNotFoundError: If account doesn't exist

359

HttpResponseError: For service errors

360

"""

361

```

362

363

Usage example:

364

365

```python

366

# Delete storage account (irreversible)

367

client.storage_accounts.delete(

368

resource_group_name="my-resource-group",

369

account_name="mystorageaccount123"

370

)

371

print("Storage account deleted successfully")

372

```

373

374

### Failover Operations

375

376

Initiate failover for geo-redundant storage accounts.

377

378

```python { .api }

379

def begin_failover(

380

self,

381

resource_group_name: str,

382

account_name: str,

383

failover_type: Literal["Planned"] = "Planned"

384

) -> LROPoller[None]:

385

"""

386

Initiates failover for a storage account in case of availability issues.

387

388

Parameters:

389

- resource_group_name: Name of the resource group

390

- account_name: Name of the storage account

391

- failover_type: Type of failover operation

392

393

Returns:

394

LROPoller for tracking the long-running failover operation

395

"""

396

```

397

398

### Hierarchical Namespace Migration

399

400

Migrate storage accounts to enable hierarchical namespace (Azure Data Lake Storage Gen2).

401

402

```python { .api }

403

def begin_hierarchical_namespace_migration(

404

self,

405

resource_group_name: str,

406

account_name: str,

407

request_type: str

408

) -> LROPoller[None]:

409

"""

410

Live migration of storage account to enable hierarchical namespace.

411

412

Parameters:

413

- resource_group_name: Name of the resource group

414

- account_name: Name of the storage account

415

- request_type: Type of migration request

416

417

Returns:

418

LROPoller for tracking the long-running migration operation

419

"""

420

421

def begin_abort_hierarchical_namespace_migration(

422

self,

423

resource_group_name: str,

424

account_name: str

425

) -> LROPoller[None]:

426

"""

427

Abort live migration of storage account to enable hierarchical namespace.

428

429

Parameters:

430

- resource_group_name: Name of the resource group

431

- account_name: Name of the storage account

432

433

Returns:

434

LROPoller for tracking the abort operation

435

"""

436

```

437

438

### Point-in-Time Recovery

439

440

Restore blob ranges to a previous point in time.

441

442

```python { .api }

443

def begin_restore_blob_ranges(

444

self,

445

resource_group_name: str,

446

account_name: str,

447

parameters: BlobRestoreParameters

448

) -> LROPoller[BlobRestoreStatus]:

449

"""

450

Restore blob ranges for the specified storage account.

451

452

Parameters:

453

- resource_group_name: Name of the resource group

454

- account_name: Name of the storage account

455

- parameters: Parameters for blob restore operation

456

457

Returns:

458

LROPoller for tracking the restore operation status

459

"""

460

```

461

462

### Customer-Initiated Migration

463

464

Manage customer-initiated migration operations.

465

466

```python { .api }

467

def begin_customer_initiated_migration(

468

self,

469

resource_group_name: str,

470

account_name: str,

471

parameters: StorageAccountMigration

472

) -> LROPoller[StorageAccount]:

473

"""

474

Account Migration request can be triggered for a storage account.

475

476

Parameters:

477

- resource_group_name: Name of the resource group

478

- account_name: Name of the storage account

479

- parameters: Migration parameters

480

481

Returns:

482

LROPoller for tracking the migration operation

483

"""

484

485

def get_customer_initiated_migration(

486

self,

487

resource_group_name: str,

488

account_name: str

489

) -> StorageAccountMigration:

490

"""

491

Gets the status of the ongoing migration for the specified storage account.

492

493

Parameters:

494

- resource_group_name: Name of the resource group

495

- account_name: Name of the storage account

496

497

Returns:

498

StorageAccountMigration: Current migration status

499

"""

500

```

501

502

### User Delegation Key Management

503

504

Manage user delegation keys for Azure AD-based authentication.

505

506

```python { .api }

507

def revoke_user_delegation_keys(

508

self,

509

resource_group_name: str,

510

account_name: str

511

) -> None:

512

"""

513

Revoke user delegation keys for the specified storage account.

514

515

Parameters:

516

- resource_group_name: Name of the resource group

517

- account_name: Name of the storage account

518

"""

519

```

520

521

## Types

522

523

```python { .api }

524

class StorageAccountCheckNameAvailabilityParameters:

525

"""Parameters for checking storage account name availability."""

526

name: str

527

type_: str # Always "Microsoft.Storage/storageAccounts"

528

529

class CheckNameAvailabilityResult:

530

"""Result of name availability check."""

531

name_available: bool

532

reason: str # "AccountNameInvalid" or "AlreadyExists"

533

message: str

534

535

class StorageAccountCreateParameters:

536

"""Parameters for creating a storage account."""

537

sku: Sku

538

kind: Kind

539

location: str

540

extended_location: Optional[ExtendedLocation]

541

tags: Optional[Dict[str, str]]

542

identity: Optional[Identity]

543

properties: Optional[StorageAccountPropertiesCreateParameters]

544

545

class StorageAccountUpdateParameters:

546

"""Parameters for updating a storage account."""

547

sku: Optional[Sku]

548

tags: Optional[Dict[str, str]]

549

identity: Optional[Identity]

550

properties: Optional[StorageAccountPropertiesUpdateParameters]

551

access_tier: Optional[AccessTier]

552

553

class StorageAccount:

554

"""Storage account resource representation."""

555

id: str

556

name: str

557

type_: str

558

location: str

559

tags: Optional[Dict[str, str]]

560

sku: Sku

561

kind: Kind

562

identity: Optional[Identity]

563

properties: StorageAccountProperties

564

565

class StorageAccountKey:

566

"""Storage account access key."""

567

key_name: str

568

value: str

569

permissions: KeyPermission

570

creation_time: datetime

571

572

class StorageAccountListKeysResult:

573

"""Result containing storage account keys."""

574

keys: List[StorageAccountKey]

575

576

class AccountSasParameters:

577

"""Parameters for generating account SAS token."""

578

services: Services

579

resource_types: SignedResourceTypes

580

permissions: Permissions

581

ip_address_or_range: Optional[str]

582

protocols: Optional[HttpProtocol]

583

shared_access_start_time: Optional[datetime]

584

shared_access_expiry_time: datetime

585

key_to_sign: Optional[str]

586

```