or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

compute-services.mdindex.mdmessaging-integration.mdmonitoring-analytics.mdplatform-services.mdresource-management.mdsecurity-identity.md

platform-services.mddocs/

0

# Platform Services

1

2

Azure platform services provide container orchestration, service fabric management, and legacy service management capabilities. This includes Service Fabric for microservices orchestration and legacy Azure Service Management APIs.

3

4

## Capabilities

5

6

### Azure Service Fabric

7

8

Provides distributed systems platform for packaging, deploying, and managing scalable and reliable microservices and containers. Supports stateless and stateful services with built-in orchestration capabilities.

9

10

```python { .api }

11

class ServiceFabricClientAPIs:

12

"""

13

Client for Azure Service Fabric operations.

14

15

Parameters:

16

- Various configuration parameters for connecting to Service Fabric cluster

17

"""

18

def __init__(self, **kwargs): ...

19

20

@property

21

def cluster(self): ... # Cluster operations

22

23

@property

24

def node(self): ... # Node operations

25

26

@property

27

def application_type(self): ... # Application type operations

28

29

@property

30

def application(self): ... # Application operations

31

32

@property

33

def service_type(self): ... # Service type operations

34

35

@property

36

def service(self): ... # Service operations

37

38

@property

39

def partition(self): ... # Partition operations

40

41

@property

42

def replica(self): ... # Replica operations

43

44

@property

45

def code_package(self): ... # Code package operations

46

47

@property

48

def property(self): ... # Property operations

49

50

@property

51

def repair_task(self): ... # Repair task operations

52

53

@property

54

def infrastructure_service(self): ... # Infrastructure service operations

55

56

@property

57

def backup_restore(self): ... # Backup and restore operations

58

59

@property

60

def events_store(self): ... # Events store operations

61

62

@property

63

def mesh_gateway(self): ... # Service Fabric Mesh gateway operations

64

65

@property

66

def mesh_volume(self): ... # Service Fabric Mesh volume operations

67

68

@property

69

def mesh_secret(self): ... # Service Fabric Mesh secret operations

70

71

@property

72

def mesh_secret_value(self): ... # Service Fabric Mesh secret value operations

73

74

@property

75

def mesh_network(self): ... # Service Fabric Mesh network operations

76

77

@property

78

def mesh_application(self): ... # Service Fabric Mesh application operations

79

80

@property

81

def mesh_service(self): ... # Service Fabric Mesh service operations

82

83

@property

84

def mesh_code_package(self): ... # Service Fabric Mesh code package operations

85

86

@property

87

def mesh_service_replica(self): ... # Service Fabric Mesh service replica operations

88

```

89

90

#### Cluster Operations

91

92

Manage Service Fabric cluster information and health.

93

94

```python { .api }

95

class ClusterOperations:

96

def get_cluster_manifest(self, **kwargs):

97

"""Get the Service Fabric cluster manifest."""

98

99

def get_cluster_health(self, **kwargs):

100

"""Get cluster health information."""

101

102

def report_cluster_health(self, health_information, **kwargs):

103

"""Report health information about the cluster."""

104

105

def get_provisioned_fabric_code_version_info_list(self, **kwargs):

106

"""Get list of fabric code versions provisioned in the cluster."""

107

108

def get_provisioned_fabric_config_version_info_list(self, **kwargs):

109

"""Get list of fabric config versions provisioned in the cluster."""

110

111

def provision_cluster(self, provision_fabric_description, **kwargs):

112

"""Provision code or configuration packages of a Service Fabric cluster."""

113

114

def unprovision_cluster(self, unprovision_fabric_description, **kwargs):

115

"""Unprovision code or configuration packages of a Service Fabric cluster."""

116

117

def start_cluster_upgrade(self, start_cluster_upgrade_description, **kwargs):

118

"""Start upgrading the code or configuration version of a Service Fabric cluster."""

119

120

def get_cluster_upgrade_progress(self, **kwargs):

121

"""Get the progress of the current cluster upgrade."""

122

123

def update_cluster_upgrade(self, update_cluster_upgrade_description, **kwargs):

124

"""Update parameters of a cluster upgrade."""

125

126

def resume_cluster_upgrade(self, resume_cluster_upgrade_description, **kwargs):

127

"""Resume an unmonitored Service Fabric cluster upgrade."""

128

129

def rollback_cluster_upgrade(self, **kwargs):

130

"""Rollback the upgrade of a Service Fabric cluster."""

131

```

132

133

#### Application Operations

134

135

Manage Service Fabric applications and their lifecycle.

136

137

```python { .api }

138

class ApplicationOperations:

139

def get_applications_info_list(self, **kwargs):

140

"""Get list of applications deployed in the Service Fabric cluster."""

141

142

def get_application_info(self, application_id, **kwargs):

143

"""Get information about a Service Fabric application."""

144

145

def create_application(self, application_description, **kwargs):

146

"""Create a Service Fabric application."""

147

148

def delete_application(self, application_id, **kwargs):

149

"""Delete a Service Fabric application."""

150

151

def get_application_load_info(self, application_id, **kwargs):

152

"""Get load information of a Service Fabric application."""

153

154

def get_application_health(self, application_id, **kwargs):

155

"""Get health information of a Service Fabric application."""

156

157

def report_application_health(self, application_id, health_information, **kwargs):

158

"""Report health information about a Service Fabric application."""

159

160

def start_application_upgrade(self, application_id, application_upgrade_description, **kwargs):

161

"""Start upgrading an application in the Service Fabric cluster."""

162

163

def get_application_upgrade_progress(self, application_id, **kwargs):

164

"""Get details for the latest upgrade performed on this application."""

165

166

def update_application_upgrade(self, application_id, application_upgrade_update_description, **kwargs):

167

"""Update an ongoing application upgrade in the Service Fabric cluster."""

168

169

def resume_application_upgrade(self, application_id, resume_application_upgrade_description, **kwargs):

170

"""Resume upgrading an application in the Service Fabric cluster."""

171

172

def rollback_application_upgrade(self, application_id, **kwargs):

173

"""Start rolling back the currently on-going upgrade of an application."""

174

```

175

176

#### Service Operations

177

178

Manage Service Fabric services within applications.

179

180

```python { .api }

181

class ServiceOperations:

182

def get_services_info_list(self, application_id, **kwargs):

183

"""Get list of services belonging to the specified application."""

184

185

def get_service_info(self, application_id, service_id, **kwargs):

186

"""Get information about the specified service."""

187

188

def create_service(self, application_id, service_description, **kwargs):

189

"""Create a Service Fabric service."""

190

191

def create_service_from_template(self, application_id, service_from_template_description, **kwargs):

192

"""Create a Service Fabric service from the service template."""

193

194

def delete_service(self, service_id, **kwargs):

195

"""Delete an existing Service Fabric service."""

196

197

def update_service(self, service_id, service_update_description, **kwargs):

198

"""Update a Service Fabric service using the specified update description."""

199

200

def get_service_description(self, service_id, **kwargs):

201

"""Get the description of an existing Service Fabric service."""

202

203

def get_service_health(self, service_id, **kwargs):

204

"""Get health information of the specified Service Fabric service."""

205

206

def report_service_health(self, service_id, health_information, **kwargs):

207

"""Report health information about the specified Service Fabric service."""

208

209

def resolve_service(self, service_id, **kwargs):

210

"""Resolve a Service Fabric partition to get the endpoints of the service replicas."""

211

```

212

213

### Azure Service Management (Legacy)

214

215

Provides legacy Azure Service Management API capabilities for older Azure services and deployments. This includes classic virtual machines, cloud services, and storage accounts.

216

217

```python { .api }

218

class ServiceManagementService:

219

"""

220

Client for Azure Service Management (Legacy) operations.

221

222

Parameters:

223

- subscription_id: str, Azure subscription ID

224

- certificate_path: str, Path to management certificate file

225

- host: str, Service management endpoint (optional)

226

"""

227

def __init__(self, subscription_id: str, certificate_path: str, host: str = None): ...

228

229

# Cloud service operations

230

def list_hosted_services(self): ...

231

def get_hosted_service_properties(self, service_name: str, embed_detail: bool = False): ...

232

def create_hosted_service(self, service_name: str, label: str, description: str = None,

233

location: str = None, affinity_group: str = None): ...

234

def update_hosted_service(self, service_name: str, label: str = None, description: str = None): ...

235

def delete_hosted_service(self, service_name: str): ...

236

def check_hosted_service_name_availability(self, service_name: str): ...

237

238

# Deployment operations

239

def get_deployment_by_slot(self, service_name: str, deployment_slot: str): ...

240

def get_deployment_by_name(self, service_name: str, deployment_name: str): ...

241

def create_deployment(self, service_name: str, deployment_slot: str, name: str,

242

package_url: str, label: str, configuration: str, **kwargs): ...

243

def delete_deployment(self, service_name: str, deployment_name: str): ...

244

def swap_deployment(self, service_name: str, production_deployment: str,

245

source_deployment: str): ...

246

def update_deployment_status(self, service_name: str, deployment_name: str, status: str): ...

247

def upgrade_deployment(self, service_name: str, deployment_name: str, mode: str,

248

package_url: str, configuration: str, label: str, **kwargs): ...

249

def rollback_update_or_upgrade(self, service_name: str, deployment_name: str, mode: str): ...

250

def reboot_role_instance(self, service_name: str, deployment_name: str, role_instance_name: str): ...

251

def reimage_role_instance(self, service_name: str, deployment_name: str, role_instance_name: str): ...

252

253

# Virtual machine operations

254

def create_virtual_machine_deployment(self, service_name: str, deployment_name: str,

255

deployment_slot: str, label: str, role_name: str,

256

system_config: object, os_virtual_hard_disk: object, **kwargs): ...

257

def add_role(self, service_name: str, deployment_name: str, role_name: str,

258

system_config: object, os_virtual_hard_disk: object, **kwargs): ...

259

def update_role(self, service_name: str, deployment_name: str, role_name: str, **kwargs): ...

260

def delete_role(self, service_name: str, deployment_name: str, role_name: str): ...

261

def restart_role(self, service_name: str, deployment_name: str, role_name: str): ...

262

def shutdown_role(self, service_name: str, deployment_name: str, role_name: str): ...

263

def start_role(self, service_name: str, deployment_name: str, role_name: str): ...

264

def capture_role(self, service_name: str, deployment_name: str, role_name: str,

265

post_capture_action: str, target_image_name: str, target_image_label: str): ...

266

267

# Storage account operations

268

def list_storage_accounts(self): ...

269

def get_storage_account_properties(self, service_name: str): ...

270

def get_storage_account_keys(self, service_name: str): ...

271

def regenerate_storage_account_keys(self, service_name: str, key_type: str): ...

272

def create_storage_account(self, service_name: str, label: str, **kwargs): ...

273

def update_storage_account(self, service_name: str, **kwargs): ...

274

def delete_storage_account(self, service_name: str): ...

275

def check_storage_account_name_availability(self, service_name: str): ...

276

277

# Affinity group operations

278

def list_affinity_groups(self): ...

279

def get_affinity_group_properties(self, affinity_group_name: str): ...

280

def create_affinity_group(self, name: str, label: str, location: str, description: str = None): ...

281

def update_affinity_group(self, affinity_group_name: str, label: str = None, description: str = None): ...

282

def delete_affinity_group(self, affinity_group_name: str): ...

283

284

# Location operations

285

def list_locations(self): ...

286

287

# Operating system operations

288

def list_operating_systems(self): ...

289

def list_operating_system_families(self): ...

290

291

# Subscription operations

292

def get_subscription(self): ...

293

def list_subscription_operations(self, start_time: str = None, end_time: str = None,

294

object_id_filter: str = None, operation_result_filter: str = None,

295

continuation_token: str = None): ...

296

297

# Certificate operations

298

def list_service_certificates(self, service_name: str): ...

299

def get_service_certificate(self, service_name: str, thumbprint_algorithm: str, thumbprint_hex: str): ...

300

def add_service_certificate(self, service_name: str, data: str, certificate_format: str, password: str = None): ...

301

def delete_service_certificate(self, service_name: str, thumbprint_algorithm: str, thumbprint_hex: str): ...

302

303

# Management certificate operations

304

def list_management_certificates(self): ...

305

def get_management_certificate(self, thumbprint: str): ...

306

def add_management_certificate(self, public_key: str, thumbprint: str, data: str): ...

307

def delete_management_certificate(self, thumbprint: str): ...

308

309

# Reserved IP operations

310

def list_reserved_ip_addresses(self): ...

311

def get_reserved_ip_address(self, name: str): ...

312

def create_reserved_ip_address(self, name: str, location: str, label: str = None): ...

313

def delete_reserved_ip_address(self, name: str): ...

314

def associate_reserved_ip_address(self, name: str, service_name: str, deployment_name: str): ...

315

def disassociate_reserved_ip_address(self, name: str, service_name: str, deployment_name: str): ...

316

```

317

318

## Usage Examples

319

320

### Working with Service Fabric Cluster

321

322

```python

323

from azure.servicefabric import ServiceFabricClientAPIs

324

325

# Create Service Fabric client

326

sf_client = ServiceFabricClientAPIs(

327

cluster_endpoint="https://mycluster.westus.cloudapp.azure.com:19080"

328

)

329

330

# Get cluster health

331

cluster_health = sf_client.cluster.get_cluster_health()

332

print(f"Cluster health state: {cluster_health.aggregated_health_state}")

333

334

# List applications

335

applications = sf_client.application.get_applications_info_list()

336

for app in applications:

337

print(f"Application: {app.name}, Status: {app.status}")

338

339

# Get application health

340

if applications:

341

app_id = applications[0].id

342

app_health = sf_client.application.get_application_health(app_id)

343

print(f"Application health: {app_health.aggregated_health_state}")

344

345

# List services for an application

346

if applications:

347

services = sf_client.service.get_services_info_list(applications[0].id)

348

for service in services:

349

print(f"Service: {service.name}, Status: {service.service_status}")

350

```

351

352

### Creating and Managing Service Fabric Applications

353

354

```python

355

from azure.servicefabric.models import ApplicationDescription

356

357

# Create application

358

app_description = ApplicationDescription(

359

name="fabric:/MyApplication",

360

type_name="MyApplicationType",

361

type_version="1.0"

362

)

363

364

sf_client.application.create_application(app_description)

365

print("Application created successfully")

366

367

# Monitor application upgrade

368

upgrade_progress = sf_client.application.get_application_upgrade_progress("MyApplication")

369

if upgrade_progress:

370

print(f"Upgrade state: {upgrade_progress.upgrade_state}")

371

print(f"Current upgrade domain: {upgrade_progress.current_upgrade_domain_progress}")

372

373

# Create service within application

374

from azure.servicefabric.models import StatelessServiceDescription

375

376

service_description = StatelessServiceDescription(

377

service_name="fabric:/MyApplication/MyService",

378

service_type_name="MyServiceType",

379

partition_description={

380

"PartitionScheme": "Singleton"

381

},

382

instance_count=3

383

)

384

385

sf_client.service.create_service("MyApplication", service_description)

386

print("Service created successfully")

387

```

388

389

### Working with Legacy Service Management

390

391

```python

392

from azure.servicemanagement import ServiceManagementService

393

394

# Create service management client

395

sms = ServiceManagementService(

396

subscription_id='your-subscription-id',

397

certificate_path='/path/to/certificate.pem'

398

)

399

400

# List hosted services (cloud services)

401

hosted_services = sms.list_hosted_services()

402

for service in hosted_services:

403

print(f"Hosted Service: {service.service_name}")

404

print(f"Location: {service.hosted_service_properties.location}")

405

406

# Get hosted service details

407

if hosted_services:

408

service_name = hosted_services[0].service_name

409

service_props = sms.get_hosted_service_properties(service_name, embed_detail=True)

410

print(f"Service description: {service_props.hosted_service_properties.description}")

411

412

# List deployments

413

if service_props.deployments:

414

for deployment in service_props.deployments:

415

print(f"Deployment: {deployment.name}, Status: {deployment.status}")

416

417

# List storage accounts

418

storage_accounts = sms.list_storage_accounts()

419

for storage in storage_accounts:

420

print(f"Storage: {storage.service_name}")

421

print(f"Location: {storage.storage_service_properties.location}")

422

423

# Get storage account keys

424

if storage_accounts:

425

storage_name = storage_accounts[0].service_name

426

keys = sms.get_storage_account_keys(storage_name)

427

print(f"Primary key: {keys.storage_service_keys.primary}")

428

print(f"Secondary key: {keys.storage_service_keys.secondary}")

429

430

# List virtual machines

431

for service in hosted_services:

432

service_props = sms.get_hosted_service_properties(service.service_name, embed_detail=True)

433

if service_props.deployments:

434

for deployment in service_props.deployments:

435

if deployment.role_list:

436

for role in deployment.role_list:

437

if hasattr(role, 'role_type') and role.role_type == 'PersistentVMRole':

438

print(f"VM: {role.role_name}, Size: {role.role_size}")

439

```

440

441

### Managing Legacy Virtual Machines

442

443

```python

444

from azure.servicemanagement import (

445

OSVirtualHardDisk,

446

LinuxConfigurationSet,

447

WindowsConfigurationSet,

448

ConfigurationSet

449

)

450

451

# Create a Linux VM

452

linux_config = LinuxConfigurationSet(

453

host_name='mylinuxvm',

454

user_name='azureuser',

455

user_password='MyPassword123!',

456

disable_ssh_password_authentication=False

457

)

458

459

os_hd = OSVirtualHardDisk(

460

source_image_name='b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2-LTS-amd64-server-20150506-en-us-30GB',

461

media_link='https://mystorageaccount.blob.core.windows.net/vhds/mylinuxvm.vhd'

462

)

463

464

# Create VM deployment

465

result = sms.create_virtual_machine_deployment(

466

service_name='mylinuxservice',

467

deployment_name='mylinuxdeployment',

468

deployment_slot='production',

469

label='My Linux VM',

470

role_name='mylinuxvm',

471

system_config=linux_config,

472

os_virtual_hard_disk=os_hd,

473

role_size='Small'

474

)

475

476

print(f"VM creation request ID: {result.request_id}")

477

478

# Add data disk to VM

479

from azure.servicemanagement import DataVirtualHardDisk

480

481

data_disk = DataVirtualHardDisk(

482

host_caching='ReadOnly',

483

disk_label='Data Disk',

484

disk_name='mydatadisk',

485

lun=0,

486

media_link='https://mystorageaccount.blob.core.windows.net/vhds/mydatadisk.vhd'

487

)

488

489

sms.add_data_disk('mylinuxservice', 'mylinuxdeployment', 'mylinuxvm', data_disk)

490

print("Data disk added to VM")

491

```