or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/pypi-azure-mgmt-resource

Microsoft Azure Resource Management Client Library for Python providing comprehensive Azure resource lifecycle, governance, and deployment capabilities.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-resource@24.0.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-resource@24.0.0

0

# Azure Resource Management SDK

1

2

Microsoft Azure Resource Management Client Library for Python provides comprehensive Azure resource lifecycle, governance, and deployment capabilities. This library enables programmatic management of Azure resources, subscriptions, resource groups, policies, locks, and applications through multiple specialized client classes.

3

4

## Package Information

5

6

- **Package Name**: azure-mgmt-resource

7

- **Package Type**: pip

8

- **Language**: Python

9

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

10

- **Authentication**: `pip install azure-identity` (required for authentication)

11

12

## Core Imports

13

14

```python

15

from azure.mgmt.resource import (

16

ResourceManagementClient,

17

PolicyClient,

18

SubscriptionClient,

19

FeatureClient,

20

ManagementLockClient,

21

ManagementLinkClient,

22

ApplicationClient,

23

DataBoundaryMgmtClient

24

)

25

```

26

27

For authentication:

28

29

```python

30

from azure.identity import DefaultAzureCredential

31

```

32

33

## Basic Usage

34

35

```python

36

import os

37

from azure.identity import DefaultAzureCredential

38

from azure.mgmt.resource import ResourceManagementClient

39

40

# Authentication

41

credential = DefaultAzureCredential()

42

subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")

43

44

# Create client

45

client = ResourceManagementClient(

46

credential=credential,

47

subscription_id=subscription_id

48

)

49

50

# List resource groups

51

resource_groups = client.resource_groups.list()

52

for rg in resource_groups:

53

print(f"Resource Group: {rg.name} in {rg.location}")

54

55

# Get a specific resource group

56

rg = client.resource_groups.get("my-resource-group")

57

print(f"Resource Group Tags: {rg.tags}")

58

```

59

60

## Architecture

61

62

The Azure Resource Management SDK is organized into specialized client classes, each targeting specific Azure management capabilities:

63

64

- **Core Resource Management**: ResourceManagementClient for resources, resource groups, deployments, and providers

65

- **Governance & Compliance**: PolicyClient for Azure Policy management and compliance

66

- **Access Control**: ManagementLockClient for resource locks and ManagementLinkClient for resource relationships

67

- **Service Management**: SubscriptionClient for subscription operations and FeatureClient for feature management

68

- **Application Management**: ApplicationClient for managed applications and DataBoundaryMgmtClient for data boundaries

69

70

Each client supports multiple API versions, async operations, and follows Azure SDK patterns for authentication, error handling, and pagination.

71

72

## Authentication Requirements

73

74

All clients require Azure credentials. Set these environment variables:

75

76

- `AZURE_CLIENT_ID` - Azure client ID

77

- `AZURE_TENANT_ID` - Azure tenant ID

78

- `AZURE_CLIENT_SECRET` - Azure client secret

79

- `AZURE_SUBSCRIPTION_ID` - Azure subscription ID

80

81

## Capabilities

82

83

### Core Resource Management

84

85

Comprehensive resource lifecycle management including deployments, resource groups, providers, and resource operations. This is the primary client for most Azure resource management tasks.

86

87

```python { .api }

88

class ResourceManagementClient:

89

def __init__(self, credential, subscription_id: str, **kwargs): ...

90

91

@property

92

def resources(self) -> ResourcesOperations: ...

93

@property

94

def resource_groups(self) -> ResourceGroupsOperations: ...

95

@property

96

def deployments(self) -> DeploymentsOperations: ...

97

@property

98

def providers(self) -> ProvidersOperations: ...

99

@property

100

def tags(self) -> TagsOperations: ...

101

```

102

103

[Resource Management](./resource-management.md)

104

105

### Policy and Governance

106

107

Azure Policy management for implementing governance, compliance, and security standards across Azure resources through policy definitions, assignments, and compliance monitoring.

108

109

```python { .api }

110

class PolicyClient:

111

def __init__(self, credential, subscription_id: str, **kwargs): ...

112

113

@property

114

def policy_assignments(self) -> PolicyAssignmentsOperations: ...

115

@property

116

def policy_definitions(self) -> PolicyDefinitionsOperations: ...

117

@property

118

def policy_set_definitions(self) -> PolicySetDefinitionsOperations: ...

119

```

120

121

[Policy and Governance](./policy-governance.md)

122

123

### Subscription and Feature Management

124

125

Subscription operations and Azure feature management including feature registration, tenant-level operations, and subscription metadata management.

126

127

```python { .api }

128

class SubscriptionClient:

129

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

130

131

@property

132

def subscriptions(self) -> SubscriptionsOperations: ...

133

@property

134

def tenants(self) -> TenantsOperations: ...

135

136

class FeatureClient:

137

def __init__(self, credential, subscription_id: str, **kwargs): ...

138

139

@property

140

def features(self) -> FeaturesOperations: ...

141

@property

142

def subscription_feature_registrations(self) -> SubscriptionFeatureRegistrationsOperations: ...

143

```

144

145

[Subscription and Features](./subscription-features.md)

146

147

### Resource Protection and Linking

148

149

Resource locks for preventing accidental deletion or modification, resource links for creating relationships, managed applications, and data boundary management.

150

151

```python { .api }

152

class ManagementLockClient:

153

def __init__(self, credential, subscription_id: str, **kwargs): ...

154

155

@property

156

def management_locks(self) -> ManagementLocksOperations: ...

157

158

class ManagementLinkClient:

159

def __init__(self, credential, subscription_id: str, **kwargs): ...

160

161

@property

162

def resource_links(self) -> ResourceLinksOperations: ...

163

164

class ApplicationClient:

165

def __init__(self, credential, subscription_id: str, **kwargs): ...

166

167

@property

168

def applications(self) -> ApplicationsOperations: ...

169

@property

170

def application_definitions(self) -> ApplicationDefinitionsOperations: ...

171

172

class DataBoundaryMgmtClient:

173

def __init__(self, credential, subscription_id: str, **kwargs): ...

174

175

@property

176

def data_boundaries(self) -> DataBoundariesOperations: ...

177

```

178

179

[Resource Protection and Linking](./resource-protection.md)

180

181

## Common Types

182

183

```python { .api }

184

class Resource:

185

"""Base resource representation."""

186

id: str

187

name: str

188

type: str

189

location: str

190

tags: dict

191

192

class ResourceGroup:

193

"""Resource group representation."""

194

id: str

195

name: str

196

location: str

197

properties: ResourceGroupProperties

198

tags: dict

199

managed_by: str

200

201

class GenericResource(Resource):

202

"""Generic resource with extended properties."""

203

plan: Plan

204

properties: object

205

kind: str

206

managed_by: str

207

sku: Sku

208

identity: Identity

209

210

# Authentication and client types

211

class DefaultAzureCredential:

212

"""Default Azure credential provider."""

213

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

214

215

# Common result types

216

class ResourceListResult:

217

"""Paginated list of resources."""

218

value: List[GenericResource]

219

next_link: str

220

221

class ResourceGroupListResult:

222

"""Paginated list of resource groups."""

223

value: List[ResourceGroup]

224

next_link: str

225

```

226

227

## Error Handling

228

229

```python { .api }

230

from azure.core.exceptions import (

231

HttpResponseError,

232

ResourceNotFoundError,

233

ResourceExistsError

234

)

235

236

try:

237

resource_group = client.resource_groups.get("nonexistent-rg")

238

except ResourceNotFoundError:

239

print("Resource group not found")

240

except HttpResponseError as e:

241

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

242

```