or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

applications.mdbatch-accounts.mdcertificates.mdindex.mdlocation-services.mdnetwork-security.mdpools.md

location-services.mddocs/

0

# Location Services

1

2

Regional quota management and virtual machine SKU availability queries for Azure Batch service planning and capacity management.

3

4

## Capabilities

5

6

### Quota Management

7

8

Retrieves regional quota information for Batch accounts and compute resources.

9

10

```python { .api }

11

def get_quotas(

12

location_name: str,

13

**kwargs: Any

14

) -> BatchLocationQuota:

15

"""

16

Gets the Batch service quotas for the specified subscription at the given location.

17

18

Args:

19

location_name (str): The region for which to retrieve quota information

20

21

Returns:

22

BatchLocationQuota: The quota information for the location

23

"""

24

```

25

26

### Virtual Machine SKU Availability

27

28

Lists available virtual machine SKUs and their capabilities in a specific region.

29

30

```python { .api }

31

def list_supported_virtual_machine_skus(

32

location_name: str,

33

maxresults: int = None,

34

filter: str = None,

35

**kwargs: Any

36

) -> ItemPaged[SupportedSku]:

37

"""

38

Gets the list of Batch-supported Virtual Machine VM sizes available at the given location.

39

40

Args:

41

location_name (str): The region for which to retrieve available sizes

42

maxresults (int, optional): Maximum number of results to return

43

filter (str, optional): OData filter clause

44

45

Returns:

46

ItemPaged[SupportedSku]: Paginated list of supported VM SKUs

47

"""

48

```

49

50

### Name Availability Checking

51

52

Checks whether a Batch account name is available in a specific region.

53

54

```python { .api }

55

def check_name_availability(

56

location_name: str,

57

parameters: CheckNameAvailabilityParameters,

58

**kwargs: Any

59

) -> CheckNameAvailabilityResult:

60

"""

61

Checks whether the Batch account name is available in the specified region.

62

63

Args:

64

location_name (str): The desired region for the Batch account

65

parameters (CheckNameAvailabilityParameters): Name availability check parameters

66

67

Returns:

68

CheckNameAvailabilityResult: The name availability result

69

"""

70

```

71

72

## Types

73

74

### Quota Information Types

75

76

```python { .api }

77

class BatchLocationQuota:

78

account_quota: int

79

80

class VirtualMachineFamilyCoreQuota:

81

name: str

82

core_quota: int

83

```

84

85

### Virtual Machine SKU Types

86

87

```python { .api }

88

class SupportedSku:

89

name: str

90

family_name: str

91

capabilities: list

92

93

class SkuCapability:

94

name: str

95

value: str

96

```

97

98

### Name Availability Types

99

100

```python { .api }

101

class CheckNameAvailabilityParameters:

102

name: str

103

type: str

104

105

class CheckNameAvailabilityResult:

106

name_available: bool

107

reason: NameAvailabilityReason

108

message: str

109

110

class NameAvailabilityReason:

111

INVALID = "Invalid"

112

ALREADY_EXISTS = "AlreadyExists"

113

```

114

115

## Usage Examples

116

117

### Checking Regional Quotas

118

119

```python

120

# Get quota information for a region

121

quota_info = client.location.get_quotas("East US")

122

print(f"Account quota: {quota_info.account_quota}")

123

```

124

125

### Finding Available VM SKUs

126

127

```python

128

# List all supported VM SKUs in a region

129

skus = client.location.list_supported_virtual_machine_skus("East US")

130

131

print("Available VM SKUs:")

132

for sku in skus:

133

print(f"- {sku.name} (Family: {sku.family_name})")

134

135

# Show capabilities

136

if sku.capabilities:

137

for capability in sku.capabilities:

138

print(f" {capability.name}: {capability.value}")

139

```

140

141

### Filtering VM SKUs

142

143

```python

144

# Filter SKUs by specific criteria

145

gpu_skus = client.location.list_supported_virtual_machine_skus(

146

"East US",

147

filter="familyName eq 'standardNCFamily'"

148

)

149

150

print("GPU-enabled SKUs:")

151

for sku in gpu_skus:

152

print(f"- {sku.name}")

153

```

154

155

### Checking Account Name Availability

156

157

```python

158

from azure.mgmt.batch.models import CheckNameAvailabilityParameters

159

160

# Check if a Batch account name is available

161

name_check = CheckNameAvailabilityParameters(

162

name="my-desired-batch-account",

163

type="Microsoft.Batch/batchAccounts"

164

)

165

166

availability = client.location.check_name_availability("East US", name_check)

167

168

if availability.name_available:

169

print("Name is available!")

170

else:

171

print(f"Name not available: {availability.reason}")

172

print(f"Message: {availability.message}")

173

```

174

175

### Regional Capacity Planning

176

177

```python

178

def plan_batch_deployment(region: str, desired_vm_family: str):

179

"""Plan a Batch deployment for a specific region and VM family."""

180

181

# Check regional quotas

182

quota = client.location.get_quotas(region)

183

print(f"Region: {region}")

184

print(f"Max Batch accounts: {quota.account_quota}")

185

186

# Find available SKUs in the desired family

187

family_filter = f"familyName eq '{desired_vm_family}'"

188

skus = client.location.list_supported_virtual_machine_skus(

189

region,

190

filter=family_filter

191

)

192

193

available_skus = list(skus)

194

if available_skus:

195

print(f"\nAvailable SKUs in {desired_vm_family} family:")

196

for sku in available_skus:

197

print(f"- {sku.name}")

198

return True

199

else:

200

print(f"\nNo SKUs available in {desired_vm_family} family")

201

return False

202

203

# Plan deployment

204

can_deploy = plan_batch_deployment("East US", "standardDFamily")

205

```

206

207

### Multi-Region Analysis

208

209

```python

210

def analyze_regions(regions: list, vm_requirements: list):

211

"""Analyze multiple regions for VM availability."""

212

213

results = {}

214

215

for region in regions:

216

print(f"\nAnalyzing {region}...")

217

region_info = {

218

"quota": client.location.get_quotas(region),

219

"available_skus": set()

220

}

221

222

# Get all available SKUs

223

skus = client.location.list_supported_virtual_machine_skus(region)

224

for sku in skus:

225

region_info["available_skus"].add(sku.name)

226

227

# Check if required SKUs are available

228

missing_skus = []

229

for required_sku in vm_requirements:

230

if required_sku not in region_info["available_skus"]:

231

missing_skus.append(required_sku)

232

233

region_info["missing_skus"] = missing_skus

234

region_info["suitable"] = len(missing_skus) == 0

235

236

results[region] = region_info

237

238

print(f" Account quota: {region_info['quota'].account_quota}")

239

print(f" Available SKUs: {len(region_info['available_skus'])}")

240

print(f" Suitable for requirements: {region_info['suitable']}")

241

242

if missing_skus:

243

print(f" Missing SKUs: {', '.join(missing_skus)}")

244

245

return results

246

247

# Analyze multiple regions

248

regions_to_check = ["East US", "West US 2", "UK South"]

249

required_vms = ["Standard_D2s_v3", "Standard_F4s_v2"]

250

251

analysis = analyze_regions(regions_to_check, required_vms)

252

```