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

index.mddocs/

0

# Azure Storage Management

1

2

Microsoft Azure Storage Management Client Library for Python provides comprehensive Python client library for managing Azure Storage services through the Azure Resource Manager APIs. It enables developers to programmatically create, configure, and manage Azure Storage accounts, blob containers, file shares, queues, and tables with full support for Azure's storage management features including access policies, encryption settings, network rules, and compliance configurations.

3

4

## Package Information

5

6

- **Package Name**: azure-mgmt-storage

7

- **Language**: Python

8

- **Installation**: `pip install azure-mgmt-storage`

9

- **Minimum Python Version**: 3.9

10

11

## Core Imports

12

13

```python

14

from azure.mgmt.storage import StorageManagementClient

15

from azure.identity import DefaultAzureCredential

16

```

17

18

Async version:

19

20

```python

21

from azure.mgmt.storage.aio import StorageManagementClient

22

from azure.identity.aio import DefaultAzureCredential

23

```

24

25

## Basic Usage

26

27

```python

28

from azure.mgmt.storage import StorageManagementClient

29

from azure.identity import DefaultAzureCredential

30

31

# Create client

32

credential = DefaultAzureCredential()

33

client = StorageManagementClient(

34

credential=credential,

35

subscription_id="your-subscription-id"

36

)

37

38

# List storage accounts

39

accounts = list(client.storage_accounts.list())

40

for account in accounts:

41

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

42

43

# Create a storage account

44

from azure.mgmt.storage.models import StorageAccountCreateParameters, Sku, Kind

45

46

storage_account_params = StorageAccountCreateParameters(

47

sku=Sku(name="Standard_LRS"),

48

kind=Kind.STORAGE_V2,

49

location="East US"

50

)

51

52

# Begin long-running operation

53

poller = client.storage_accounts.begin_create(

54

resource_group_name="my-resource-group",

55

account_name="mystorageaccount123",

56

parameters=storage_account_params

57

)

58

59

# Wait for completion

60

account = poller.result()

61

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

62

```

63

64

## Architecture

65

66

The Azure Storage Management API is organized around resource management operations:

67

68

- **StorageManagementClient**: Main client providing access to all storage management operations

69

- **Operations Classes**: Specialized operation groups for different resource types (storage accounts, blob containers, file shares, etc.)

70

- **Models**: Data classes representing Azure Storage resources and request/response structures

71

- **Long-Running Operations**: Async operations that return pollers for tracking completion status

72

73

Both synchronous and asynchronous clients are available, with identical API surfaces but different execution models.

74

75

## Capabilities

76

77

### Storage Account Management

78

79

Complete lifecycle management of Azure Storage accounts including creation, deletion, configuration updates, key management, and failover operations.

80

81

```python { .api }

82

class StorageAccountsOperations:

83

def check_name_availability(

84

self,

85

account_name: StorageAccountCheckNameAvailabilityParameters

86

) -> CheckNameAvailabilityResult

87

88

def begin_create(

89

self,

90

resource_group_name: str,

91

account_name: str,

92

parameters: StorageAccountCreateParameters

93

) -> LROPoller[StorageAccount]

94

95

def delete(

96

self,

97

resource_group_name: str,

98

account_name: str

99

) -> None

100

101

def get_properties(

102

self,

103

resource_group_name: str,

104

account_name: str

105

) -> StorageAccount

106

107

def list(self) -> ItemPaged[StorageAccount]

108

109

def list_keys(

110

self,

111

resource_group_name: str,

112

account_name: str

113

) -> StorageAccountListKeysResult

114

```

115

116

[Storage Accounts](./storage-accounts.md)

117

118

### Blob Storage Management

119

120

Management of blob services, containers, and blob inventory policies with support for access policies, lifecycle management, and container-level operations.

121

122

```python { .api }

123

class BlobServicesOperations:

124

def get_service_properties(

125

self,

126

resource_group_name: str,

127

account_name: str

128

) -> BlobServiceProperties

129

130

def set_service_properties(

131

self,

132

resource_group_name: str,

133

account_name: str,

134

parameters: BlobServiceProperties

135

) -> BlobServiceProperties

136

137

class BlobContainersOperations:

138

def create(

139

self,

140

resource_group_name: str,

141

account_name: str,

142

container_name: str,

143

blob_container: BlobContainer

144

) -> BlobContainer

145

146

def list(

147

self,

148

resource_group_name: str,

149

account_name: str

150

) -> ItemPaged[ListContainerItem]

151

```

152

153

[Blob Storage](./blob-storage.md)

154

155

### File Storage Management

156

157

Azure Files service and file share management including SMB/NFS configuration, access tier management, and snapshot operations.

158

159

```python { .api }

160

class FileServicesOperations:

161

def get_service_properties(

162

self,

163

resource_group_name: str,

164

account_name: str

165

) -> FileServiceProperties

166

167

class FileSharesOperations:

168

def create(

169

self,

170

resource_group_name: str,

171

account_name: str,

172

share_name: str,

173

file_share: FileShare

174

) -> FileShare

175

176

def list(

177

self,

178

resource_group_name: str,

179

account_name: str

180

) -> ItemPaged[FileShareItem]

181

```

182

183

[File Storage](./file-storage.md)

184

185

### Queue Storage Management

186

187

Azure Queue service configuration and individual queue management operations.

188

189

```python { .api }

190

class QueueServicesOperations:

191

def get_service_properties(

192

self,

193

resource_group_name: str,

194

account_name: str

195

) -> QueueServiceProperties

196

197

class QueueOperations:

198

def create(

199

self,

200

resource_group_name: str,

201

account_name: str,

202

queue_name: str,

203

queue: StorageQueue

204

) -> StorageQueue

205

```

206

207

[Queue Storage](./queue-storage.md)

208

209

### Table Storage Management

210

211

Azure Table service configuration and table management operations.

212

213

```python { .api }

214

class TableServicesOperations:

215

def get_service_properties(

216

self,

217

resource_group_name: str,

218

account_name: str

219

) -> TableServiceProperties

220

221

class TableOperations:

222

def create(

223

self,

224

resource_group_name: str,

225

account_name: str,

226

table_name: str,

227

parameters: Table

228

) -> Table

229

```

230

231

[Table Storage](./table-storage.md)

232

233

### Security and Access Management

234

235

Management of private endpoints, local users for SFTP access, encryption scopes, and network security configurations.

236

237

```python { .api }

238

class PrivateEndpointConnectionsOperations:

239

def put(

240

self,

241

resource_group_name: str,

242

account_name: str,

243

private_endpoint_connection_name: str,

244

properties: PrivateEndpointConnection

245

) -> PrivateEndpointConnection

246

247

class LocalUsersOperations:

248

def create_or_update(

249

self,

250

resource_group_name: str,

251

account_name: str,

252

username: str,

253

properties: LocalUser

254

) -> LocalUser

255

256

class EncryptionScopesOperations:

257

def put(

258

self,

259

resource_group_name: str,

260

account_name: str,

261

encryption_scope_name: str,

262

encryption_scope: EncryptionScope

263

) -> EncryptionScope

264

265

class NetworkSecurityPerimeterConfigurationsOperations:

266

def get(

267

self,

268

resource_group_name: str,

269

account_name: str,

270

network_security_perimeter_configuration_name: str

271

) -> NetworkSecurityPerimeterConfiguration

272

273

def list(

274

self,

275

resource_group_name: str,

276

account_name: str

277

) -> ItemPaged[NetworkSecurityPerimeterConfiguration]

278

```

279

280

[Security and Access](./security-access.md)

281

282

### Policy Management

283

284

Lifecycle management policies, object replication policies, and blob inventory policies for automated data management.

285

286

```python { .api }

287

class ManagementPoliciesOperations:

288

def create_or_update(

289

self,

290

resource_group_name: str,

291

account_name: str,

292

management_policy_name: str,

293

properties: ManagementPolicy

294

) -> ManagementPolicy

295

296

class ObjectReplicationPoliciesOperations:

297

def create_or_update(

298

self,

299

resource_group_name: str,

300

account_name: str,

301

object_replication_policy_id: str,

302

properties: ObjectReplicationPolicy

303

) -> ObjectReplicationPolicy

304

```

305

306

[Policy Management](./policy-management.md)

307

308

### Storage Task Management

309

310

Storage task assignments for automated data processing and reporting on task execution.

311

312

```python { .api }

313

class StorageTaskAssignmentsOperations:

314

def create(

315

self,

316

resource_group_name: str,

317

account_name: str,

318

storage_task_assignment_name: str,

319

parameters: StorageTaskAssignment

320

) -> StorageTaskAssignment

321

```

322

323

[Storage Tasks](./storage-tasks.md)

324

325

### Utility Operations

326

327

Operations for discovering available SKUs, checking usage limits, managing deleted accounts, and retrieving service metadata.

328

329

```python { .api }

330

class SkusOperations:

331

def list(self) -> ItemPaged[SkuInformation]

332

333

class UsagesOperations:

334

def list_by_location(self, location: str) -> ItemPaged[Usage]

335

336

class DeletedAccountsOperations:

337

def list(self) -> ItemPaged[DeletedAccount]

338

339

class Operations:

340

def list(self) -> ItemPaged[Operation]

341

```

342

343

[Utilities](./utilities.md)

344

345

## Common Types

346

347

```python { .api }

348

class StorageAccount:

349

"""Storage account resource with all properties and configuration."""

350

id: str

351

name: str

352

type: str

353

location: str

354

sku: Sku

355

kind: Kind

356

properties: StorageAccountProperties

357

358

class Sku:

359

"""SKU information for storage account pricing tier."""

360

name: SkuName

361

tier: SkuTier

362

363

class StorageAccountCreateParameters:

364

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

365

sku: Sku

366

kind: Kind

367

location: str

368

tags: Dict[str, str]

369

identity: Identity

370

properties: StorageAccountPropertiesCreateParameters

371

372

# Enums

373

class Kind(str, Enum):

374

STORAGE = "Storage"

375

STORAGE_V2 = "StorageV2"

376

BLOB_STORAGE = "BlobStorage"

377

FILE_STORAGE = "FileStorage"

378

BLOCK_BLOB_STORAGE = "BlockBlobStorage"

379

380

class SkuName(str, Enum):

381

STANDARD_LRS = "Standard_LRS"

382

STANDARD_GRS = "Standard_GRS"

383

STANDARD_RAGRS = "Standard_RAGRS"

384

STANDARD_ZRS = "Standard_ZRS"

385

PREMIUM_LRS = "Premium_LRS"

386

PREMIUM_ZRS = "Premium_ZRS"

387

STANDARD_GZRS = "Standard_GZRS"

388

STANDARD_RAGZRS = "Standard_RAGZRS"

389

390

class AccessTier(str, Enum):

391

HOT = "Hot"

392

COOL = "Cool"

393

PREMIUM = "Premium"

394

COLD = "Cold"

395

```

396

397

## Error Handling

398

399

All operations may raise Azure-specific exceptions:

400

401

```python

402

from azure.core.exceptions import HttpResponseError, ResourceNotFoundError

403

from azure.mgmt.core.exceptions import ARMErrorFormat

404

405

try:

406

account = client.storage_accounts.get_properties("rg", "account")

407

except ResourceNotFoundError:

408

print("Storage account not found")

409

except HttpResponseError as e:

410

print(f"HTTP error: {e.status_code} - {e.message}")

411

```

412

413

## Async Usage

414

415

```python

416

import asyncio

417

from azure.mgmt.storage.aio import StorageManagementClient

418

from azure.identity.aio import DefaultAzureCredential

419

420

async def main():

421

credential = DefaultAzureCredential()

422

async with StorageManagementClient(

423

credential=credential,

424

subscription_id="subscription-id"

425

) as client:

426

accounts = []

427

async for account in client.storage_accounts.list():

428

accounts.append(account)

429

print(f"Found {len(accounts)} storage accounts")

430

431

asyncio.run(main())

432

```