or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

access-control.mdcache-and-credentials.mdconnected-registries.mdindex.mdprivate-networking.mdregistry-management.mdreplication-management.mdwebhook-management.md

replication-management.mddocs/

0

# Replication Management

1

2

Geographic replication management for Premium registries, enabling registry content distribution across multiple Azure regions for performance optimization, disaster recovery, and global content delivery. Replications synchronize registry content automatically and provide regional endpoints for faster access.

3

4

## Capabilities

5

6

### Replication Creation and Management

7

8

Create, update, and delete replications to distribute registry content across Azure regions with configurable settings for zone redundancy and regional optimization.

9

10

```python { .api }

11

def begin_create(resource_group_name: str, registry_name: str, replication_name: str, replication: Replication, **kwargs) -> LROPoller[Replication]:

12

"""

13

Create a replication for a container registry.

14

15

Parameters:

16

- resource_group_name: str - Name of the resource group

17

- registry_name: str - Name of the registry

18

- replication_name: str - Name of the replication (typically the region name)

19

- replication: Replication - Replication configuration parameters

20

21

Returns:

22

LROPoller[Replication] - Long-running operation poller for the replication

23

"""

24

25

def begin_delete(resource_group_name: str, registry_name: str, replication_name: str, **kwargs) -> LROPoller[None]:

26

"""

27

Delete a replication from a container registry.

28

29

Parameters:

30

- resource_group_name: str - Name of the resource group

31

- registry_name: str - Name of the registry

32

- replication_name: str - Name of the replication to delete

33

34

Returns:

35

LROPoller[None] - Long-running operation poller

36

"""

37

38

def begin_update(resource_group_name: str, registry_name: str, replication_name: str, replication_update_parameters: ReplicationUpdateParameters, **kwargs) -> LROPoller[Replication]:

39

"""

40

Update a replication for a container registry.

41

42

Parameters:

43

- resource_group_name: str - Name of the resource group

44

- registry_name: str - Name of the registry

45

- replication_name: str - Name of the replication to update

46

- replication_update_parameters: ReplicationUpdateParameters - Update parameters

47

48

Returns:

49

LROPoller[Replication] - Long-running operation poller for the updated replication

50

"""

51

```

52

53

### Replication Information and Status

54

55

Retrieve replication details, list all replications for a registry, and monitor replication status and synchronization state.

56

57

```python { .api }

58

def get(resource_group_name: str, registry_name: str, replication_name: str, **kwargs) -> Replication:

59

"""

60

Get properties of a replication.

61

62

Parameters:

63

- resource_group_name: str - Name of the resource group

64

- registry_name: str - Name of the registry

65

- replication_name: str - Name of the replication

66

67

Returns:

68

Replication - Replication resource with complete configuration and status

69

"""

70

71

def list(resource_group_name: str, registry_name: str, **kwargs) -> ItemPaged[Replication]:

72

"""

73

List all replications for a container registry.

74

75

Parameters:

76

- resource_group_name: str - Name of the resource group

77

- registry_name: str - Name of the registry

78

79

Returns:

80

ItemPaged[Replication] - Paginated list of all replications for the registry

81

"""

82

```

83

84

## Core Model Types

85

86

### Replication

87

88

```python { .api }

89

class Replication:

90

"""

91

An object that represents a replication for a container registry.

92

93

Attributes:

94

- id: str - Resource ID

95

- name: str - Resource name (typically region name)

96

- type: str - Resource type

97

- location: str - Azure region location for the replication

98

- tags: Dict[str, str] - Resource tags

99

- provisioning_state: ProvisioningState - Current provisioning state

100

- status: Status - Replication status information

101

- region_endpoint_enabled: bool - Enable regional endpoint

102

- zone_redundancy: ZoneRedundancy - Zone redundancy setting for the replication

103

"""

104

```

105

106

### ReplicationUpdateParameters

107

108

```python { .api }

109

class ReplicationUpdateParameters:

110

"""

111

Parameters for updating a replication.

112

113

Attributes:

114

- tags: Dict[str, str] - Resource tags to update

115

- region_endpoint_enabled: bool - Enable or disable regional endpoint

116

- zone_redundancy: ZoneRedundancy - Zone redundancy setting

117

"""

118

```

119

120

### Status

121

122

```python { .api }

123

class Status:

124

"""

125

Current status of a resource.

126

127

Attributes:

128

- display_status: str - Display status description

129

- message: str - Status message with additional details

130

- timestamp: datetime - Status timestamp

131

"""

132

```

133

134

## Enums

135

136

### ZoneRedundancy

137

138

```python { .api }

139

class ZoneRedundancy(str, Enum):

140

"""Zone redundancy setting for replications."""

141

ENABLED = "Enabled"

142

DISABLED = "Disabled"

143

```

144

145

### ProvisioningState

146

147

```python { .api }

148

class ProvisioningState(str, Enum):

149

"""Provisioning state of a resource."""

150

CREATING = "Creating"

151

UPDATING = "Updating"

152

DELETING = "Deleting"

153

SUCCEEDED = "Succeeded"

154

FAILED = "Failed"

155

CANCELED = "Canceled"

156

```

157

158

## Usage Examples

159

160

### Create Regional Replications for Global Distribution

161

162

```python

163

from azure.mgmt.containerregistry import ContainerRegistryManagementClient

164

from azure.mgmt.containerregistry.models import Replication, ZoneRedundancy

165

from azure.identity import DefaultAzureCredential

166

167

client = ContainerRegistryManagementClient(

168

DefaultAzureCredential(),

169

"subscription-id"

170

)

171

172

# Create replications in multiple regions for global distribution

173

regions = [

174

{"name": "westus2", "location": "West US 2", "zone_redundancy": ZoneRedundancy.ENABLED},

175

{"name": "eastus", "location": "East US", "zone_redundancy": ZoneRedundancy.ENABLED},

176

{"name": "westeurope", "location": "West Europe", "zone_redundancy": ZoneRedundancy.DISABLED},

177

{"name": "southeastasia", "location": "Southeast Asia", "zone_redundancy": ZoneRedundancy.DISABLED}

178

]

179

180

for region in regions:

181

replication_params = Replication(

182

location=region["location"],

183

zone_redundancy=region["zone_redundancy"],

184

region_endpoint_enabled=True,

185

tags={

186

"purpose": "global-distribution",

187

"region-tier": "primary" if region["zone_redundancy"] == ZoneRedundancy.ENABLED else "secondary"

188

}

189

)

190

191

print(f"Creating replication in {region['location']}...")

192

creation_poller = client.replications.begin_create(

193

"my-resource-group",

194

"my-premium-registry",

195

region["name"],

196

replication_params

197

)

198

199

# Wait for completion

200

replication = creation_poller.result()

201

print(f"Replication created in {replication.location} with status: {replication.provisioning_state}")

202

```

203

204

### Monitor Replication Status

205

206

```python

207

# List all replications and check their status

208

replications = client.replications.list("my-resource-group", "my-premium-registry")

209

210

print("Registry Replications Status:")

211

print("-" * 50)

212

for replication in replications:

213

print(f"Region: {replication.location}")

214

print(f" Status: {replication.provisioning_state}")

215

print(f" Zone Redundancy: {replication.zone_redundancy}")

216

print(f" Regional Endpoint: {replication.region_endpoint_enabled}")

217

if replication.status:

218

print(f" Display Status: {replication.status.display_status}")

219

print(f" Message: {replication.status.message}")

220

print()

221

```

222

223

### Update Replication Configuration

224

225

```python

226

from azure.mgmt.containerregistry.models import ReplicationUpdateParameters

227

228

# Enable zone redundancy for an existing replication

229

update_params = ReplicationUpdateParameters(

230

zone_redundancy=ZoneRedundancy.ENABLED,

231

region_endpoint_enabled=True,

232

tags={

233

"updated": "2024-01-15",

234

"zone-redundancy": "enabled"

235

}

236

)

237

238

update_poller = client.replications.begin_update(

239

"my-resource-group",

240

"my-premium-registry",

241

"westeurope",

242

update_params

243

)

244

245

updated_replication = update_poller.result()

246

print(f"Updated replication zone redundancy: {updated_replication.zone_redundancy}")

247

```

248

249

### Disaster Recovery Scenario

250

251

```python

252

# Create a disaster recovery replication setup

253

primary_regions = ["eastus", "westus2"] # Primary regions with zone redundancy

254

dr_regions = ["southcentralus", "northcentralus"] # DR regions

255

256

# Create primary replications with zone redundancy

257

for region in primary_regions:

258

replication_params = Replication(

259

location=region.replace("us", " US").replace("west", "West ").replace("east", "East ").title(),

260

zone_redundancy=ZoneRedundancy.ENABLED,

261

region_endpoint_enabled=True,

262

tags={

263

"tier": "primary",

264

"disaster-recovery": "true"

265

}

266

)

267

268

client.replications.begin_create(

269

"my-resource-group",

270

"my-registry",

271

region,

272

replication_params

273

).result()

274

275

# Create DR replications without zone redundancy for cost optimization

276

for region in dr_regions:

277

replication_params = Replication(

278

location=region.replace("us", " US").replace("central", " Central").replace("north", "North").replace("south", "South").title(),

279

zone_redundancy=ZoneRedundancy.DISABLED,

280

region_endpoint_enabled=False, # Disable for cost savings

281

tags={

282

"tier": "disaster-recovery",

283

"primary-backup": "true"

284

}

285

)

286

287

client.replications.begin_create(

288

"my-resource-group",

289

"my-registry",

290

region,

291

replication_params

292

).result()

293

294

print("Disaster recovery replication setup completed")

295

```

296

297

### Clean Up Replications

298

299

```python

300

# Remove replications that are no longer needed

301

replications_to_remove = ["southeastasia", "japaneast"]

302

303

for replication_name in replications_to_remove:

304

try:

305

print(f"Removing replication: {replication_name}")

306

deletion_poller = client.replications.begin_delete(

307

"my-resource-group",

308

"my-registry",

309

replication_name

310

)

311

deletion_poller.result()

312

print(f"Successfully removed replication: {replication_name}")

313

except Exception as e:

314

print(f"Failed to remove replication {replication_name}: {e}")

315

```