feat: Add Official Microsoft & Gemini Skills (845+ Total)
🚀 Impact Significantly expands the capabilities of **Antigravity Awesome Skills** by integrating official skill collections from **Microsoft** and **Google Gemini**. This update increases the total skill count to **845+**, making the library even more comprehensive for AI coding assistants. ✨ Key Changes 1. New Official Skills - **Microsoft Skills**: Added a massive collection of official skills from [microsoft/skills](https://github.com/microsoft/skills). - Includes Azure, .NET, Python, TypeScript, and Semantic Kernel skills. - Preserves the original directory structure under `skills/official/microsoft/`. - Includes plugin skills from the `.github/plugins` directory. - **Gemini Skills**: Added official Gemini API development skills under `skills/gemini-api-dev/`. 2. New Scripts & Tooling - **`scripts/sync_microsoft_skills.py`**: A robust synchronization script that: - Clones the official Microsoft repository. - Preserves the original directory heirarchy. - Handles symlinks and plugin locations. - Generates attribution metadata. - **`scripts/tests/inspect_microsoft_repo.py`**: Debug tool to inspect the remote repository structure. - **`scripts/tests/test_comprehensive_coverage.py`**: Verification script to ensure 100% of skills are captured during sync. 3. Core Improvements - **`scripts/generate_index.py`**: Enhanced frontmatter parsing to safely handle unquoted values containing `@` symbols and commas (fixing issues with some Microsoft skill descriptions). - **`package.json`**: Added `sync:microsoft` and `sync:all-official` scripts for easy maintenance. 4. Documentation - Updated `README.md` to reflect the new skill counts (845+) and added Microsoft/Gemini to the provider list. - Updated `CATALOG.md` and `skills_index.json` with the new skills. 🧪 Verification - Ran `scripts/tests/test_comprehensive_coverage.py` to verify all Microsoft skills are detected. - Validated `generate_index.py` fixes by successfully indexing the new skills.
This commit is contained in:
320
skills/official/microsoft/python/compute/botservice/SKILL.md
Normal file
320
skills/official/microsoft/python/compute/botservice/SKILL.md
Normal file
@@ -0,0 +1,320 @@
|
||||
---
|
||||
name: azure-mgmt-botservice-py
|
||||
description: |
|
||||
Azure Bot Service Management SDK for Python. Use for creating, managing, and configuring Azure Bot Service resources.
|
||||
Triggers: "azure-mgmt-botservice", "AzureBotService", "bot management", "conversational AI", "bot channels".
|
||||
---
|
||||
|
||||
# Azure Bot Service Management SDK for Python
|
||||
|
||||
Manage Azure Bot Service resources including bots, channels, and connections.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install azure-mgmt-botservice
|
||||
pip install azure-identity
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
|
||||
AZURE_RESOURCE_GROUP=<your-resource-group>
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
```python
|
||||
from azure.identity import DefaultAzureCredential
|
||||
from azure.mgmt.botservice import AzureBotService
|
||||
import os
|
||||
|
||||
credential = DefaultAzureCredential()
|
||||
client = AzureBotService(
|
||||
credential=credential,
|
||||
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]
|
||||
)
|
||||
```
|
||||
|
||||
## Create a Bot
|
||||
|
||||
```python
|
||||
from azure.mgmt.botservice import AzureBotService
|
||||
from azure.mgmt.botservice.models import Bot, BotProperties, Sku
|
||||
from azure.identity import DefaultAzureCredential
|
||||
import os
|
||||
|
||||
credential = DefaultAzureCredential()
|
||||
client = AzureBotService(
|
||||
credential=credential,
|
||||
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]
|
||||
)
|
||||
|
||||
resource_group = os.environ["AZURE_RESOURCE_GROUP"]
|
||||
bot_name = "my-chat-bot"
|
||||
|
||||
bot = client.bots.create(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
parameters=Bot(
|
||||
location="global",
|
||||
sku=Sku(name="F0"), # Free tier
|
||||
kind="azurebot",
|
||||
properties=BotProperties(
|
||||
display_name="My Chat Bot",
|
||||
description="A conversational AI bot",
|
||||
endpoint="https://my-bot-app.azurewebsites.net/api/messages",
|
||||
msa_app_id="<your-app-id>",
|
||||
msa_app_type="MultiTenant"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
print(f"Bot created: {bot.name}")
|
||||
```
|
||||
|
||||
## Get Bot Details
|
||||
|
||||
```python
|
||||
bot = client.bots.get(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name
|
||||
)
|
||||
|
||||
print(f"Bot: {bot.properties.display_name}")
|
||||
print(f"Endpoint: {bot.properties.endpoint}")
|
||||
print(f"SKU: {bot.sku.name}")
|
||||
```
|
||||
|
||||
## List Bots in Resource Group
|
||||
|
||||
```python
|
||||
bots = client.bots.list_by_resource_group(resource_group_name=resource_group)
|
||||
|
||||
for bot in bots:
|
||||
print(f"Bot: {bot.name} - {bot.properties.display_name}")
|
||||
```
|
||||
|
||||
## List All Bots in Subscription
|
||||
|
||||
```python
|
||||
all_bots = client.bots.list()
|
||||
|
||||
for bot in all_bots:
|
||||
print(f"Bot: {bot.name} in {bot.id.split('/')[4]}")
|
||||
```
|
||||
|
||||
## Update Bot
|
||||
|
||||
```python
|
||||
bot = client.bots.update(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
properties=BotProperties(
|
||||
display_name="Updated Bot Name",
|
||||
description="Updated description"
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
## Delete Bot
|
||||
|
||||
```python
|
||||
client.bots.delete(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name
|
||||
)
|
||||
```
|
||||
|
||||
## Configure Channels
|
||||
|
||||
### Add Teams Channel
|
||||
|
||||
```python
|
||||
from azure.mgmt.botservice.models import (
|
||||
BotChannel,
|
||||
MsTeamsChannel,
|
||||
MsTeamsChannelProperties
|
||||
)
|
||||
|
||||
channel = client.channels.create(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
channel_name="MsTeamsChannel",
|
||||
parameters=BotChannel(
|
||||
location="global",
|
||||
properties=MsTeamsChannel(
|
||||
properties=MsTeamsChannelProperties(
|
||||
is_enabled=True
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
### Add Direct Line Channel
|
||||
|
||||
```python
|
||||
from azure.mgmt.botservice.models import (
|
||||
BotChannel,
|
||||
DirectLineChannel,
|
||||
DirectLineChannelProperties,
|
||||
DirectLineSite
|
||||
)
|
||||
|
||||
channel = client.channels.create(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
channel_name="DirectLineChannel",
|
||||
parameters=BotChannel(
|
||||
location="global",
|
||||
properties=DirectLineChannel(
|
||||
properties=DirectLineChannelProperties(
|
||||
sites=[
|
||||
DirectLineSite(
|
||||
site_name="Default Site",
|
||||
is_enabled=True,
|
||||
is_v1_enabled=False,
|
||||
is_v3_enabled=True
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
### Add Web Chat Channel
|
||||
|
||||
```python
|
||||
from azure.mgmt.botservice.models import (
|
||||
BotChannel,
|
||||
WebChatChannel,
|
||||
WebChatChannelProperties,
|
||||
WebChatSite
|
||||
)
|
||||
|
||||
channel = client.channels.create(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
channel_name="WebChatChannel",
|
||||
parameters=BotChannel(
|
||||
location="global",
|
||||
properties=WebChatChannel(
|
||||
properties=WebChatChannelProperties(
|
||||
sites=[
|
||||
WebChatSite(
|
||||
site_name="Default Site",
|
||||
is_enabled=True
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
## Get Channel Details
|
||||
|
||||
```python
|
||||
channel = client.channels.get(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
channel_name="DirectLineChannel"
|
||||
)
|
||||
```
|
||||
|
||||
## List Channel Keys
|
||||
|
||||
```python
|
||||
keys = client.channels.list_with_keys(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
channel_name="DirectLineChannel"
|
||||
)
|
||||
|
||||
# Access Direct Line keys
|
||||
if hasattr(keys.properties, 'properties'):
|
||||
for site in keys.properties.properties.sites:
|
||||
print(f"Site: {site.site_name}")
|
||||
print(f"Key: {site.key}")
|
||||
```
|
||||
|
||||
## Bot Connections (OAuth)
|
||||
|
||||
### Create Connection Setting
|
||||
|
||||
```python
|
||||
from azure.mgmt.botservice.models import (
|
||||
ConnectionSetting,
|
||||
ConnectionSettingProperties
|
||||
)
|
||||
|
||||
connection = client.bot_connection.create(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name,
|
||||
connection_name="graph-connection",
|
||||
parameters=ConnectionSetting(
|
||||
location="global",
|
||||
properties=ConnectionSettingProperties(
|
||||
client_id="<oauth-client-id>",
|
||||
client_secret="<oauth-client-secret>",
|
||||
scopes="User.Read",
|
||||
service_provider_id="<service-provider-id>"
|
||||
)
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
### List Connections
|
||||
|
||||
```python
|
||||
connections = client.bot_connection.list_by_bot_service(
|
||||
resource_group_name=resource_group,
|
||||
resource_name=bot_name
|
||||
)
|
||||
|
||||
for conn in connections:
|
||||
print(f"Connection: {conn.name}")
|
||||
```
|
||||
|
||||
## Client Operations
|
||||
|
||||
| Operation | Method |
|
||||
|-----------|--------|
|
||||
| `client.bots` | Bot CRUD operations |
|
||||
| `client.channels` | Channel configuration |
|
||||
| `client.bot_connection` | OAuth connection settings |
|
||||
| `client.direct_line` | Direct Line channel operations |
|
||||
| `client.email` | Email channel operations |
|
||||
| `client.operations` | Available operations |
|
||||
| `client.host_settings` | Host settings operations |
|
||||
|
||||
## SKU Options
|
||||
|
||||
| SKU | Description |
|
||||
|-----|-------------|
|
||||
| `F0` | Free tier (limited messages) |
|
||||
| `S1` | Standard tier (unlimited messages) |
|
||||
|
||||
## Channel Types
|
||||
|
||||
| Channel | Class | Purpose |
|
||||
|---------|-------|---------|
|
||||
| `MsTeamsChannel` | Microsoft Teams | Teams integration |
|
||||
| `DirectLineChannel` | Direct Line | Custom client integration |
|
||||
| `WebChatChannel` | Web Chat | Embeddable web widget |
|
||||
| `SlackChannel` | Slack | Slack workspace integration |
|
||||
| `FacebookChannel` | Facebook | Messenger integration |
|
||||
| `EmailChannel` | Email | Email communication |
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use DefaultAzureCredential** for authentication
|
||||
2. **Start with F0 SKU** for development, upgrade to S1 for production
|
||||
3. **Store MSA App ID/Secret securely** — use Key Vault
|
||||
4. **Enable only needed channels** — reduces attack surface
|
||||
5. **Rotate Direct Line keys** periodically
|
||||
6. **Use managed identity** when possible for bot connections
|
||||
7. **Configure proper CORS** for Web Chat channel
|
||||
@@ -0,0 +1,252 @@
|
||||
---
|
||||
name: azure-containerregistry-py
|
||||
description: |
|
||||
Azure Container Registry SDK for Python. Use for managing container images, artifacts, and repositories.
|
||||
Triggers: "azure-containerregistry", "ContainerRegistryClient", "container images", "docker registry", "ACR".
|
||||
package: azure-containerregistry
|
||||
---
|
||||
|
||||
# Azure Container Registry SDK for Python
|
||||
|
||||
Manage container images, artifacts, and repositories in Azure Container Registry.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install azure-containerregistry
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
AZURE_CONTAINERREGISTRY_ENDPOINT=https://<registry-name>.azurecr.io
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
### Entra ID (Recommended)
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ContainerRegistryClient
|
||||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
client = ContainerRegistryClient(
|
||||
endpoint=os.environ["AZURE_CONTAINERREGISTRY_ENDPOINT"],
|
||||
credential=DefaultAzureCredential()
|
||||
)
|
||||
```
|
||||
|
||||
### Anonymous Access (Public Registry)
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ContainerRegistryClient
|
||||
|
||||
client = ContainerRegistryClient(
|
||||
endpoint="https://mcr.microsoft.com",
|
||||
credential=None,
|
||||
audience="https://mcr.microsoft.com"
|
||||
)
|
||||
```
|
||||
|
||||
## List Repositories
|
||||
|
||||
```python
|
||||
client = ContainerRegistryClient(endpoint, DefaultAzureCredential())
|
||||
|
||||
for repository in client.list_repository_names():
|
||||
print(repository)
|
||||
```
|
||||
|
||||
## Repository Operations
|
||||
|
||||
### Get Repository Properties
|
||||
|
||||
```python
|
||||
properties = client.get_repository_properties("my-image")
|
||||
print(f"Created: {properties.created_on}")
|
||||
print(f"Modified: {properties.last_updated_on}")
|
||||
print(f"Manifests: {properties.manifest_count}")
|
||||
print(f"Tags: {properties.tag_count}")
|
||||
```
|
||||
|
||||
### Update Repository Properties
|
||||
|
||||
```python
|
||||
from azure.containerregistry import RepositoryProperties
|
||||
|
||||
client.update_repository_properties(
|
||||
"my-image",
|
||||
properties=RepositoryProperties(
|
||||
can_delete=False,
|
||||
can_write=False
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
### Delete Repository
|
||||
|
||||
```python
|
||||
client.delete_repository("my-image")
|
||||
```
|
||||
|
||||
## List Tags
|
||||
|
||||
```python
|
||||
for tag in client.list_tag_properties("my-image"):
|
||||
print(f"{tag.name}: {tag.created_on}")
|
||||
```
|
||||
|
||||
### Filter by Order
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ArtifactTagOrder
|
||||
|
||||
# Most recent first
|
||||
for tag in client.list_tag_properties(
|
||||
"my-image",
|
||||
order_by=ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING
|
||||
):
|
||||
print(f"{tag.name}: {tag.last_updated_on}")
|
||||
```
|
||||
|
||||
## Manifest Operations
|
||||
|
||||
### List Manifests
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ArtifactManifestOrder
|
||||
|
||||
for manifest in client.list_manifest_properties(
|
||||
"my-image",
|
||||
order_by=ArtifactManifestOrder.LAST_UPDATED_ON_DESCENDING
|
||||
):
|
||||
print(f"Digest: {manifest.digest}")
|
||||
print(f"Tags: {manifest.tags}")
|
||||
print(f"Size: {manifest.size_in_bytes}")
|
||||
```
|
||||
|
||||
### Get Manifest Properties
|
||||
|
||||
```python
|
||||
manifest = client.get_manifest_properties("my-image", "latest")
|
||||
print(f"Digest: {manifest.digest}")
|
||||
print(f"Architecture: {manifest.architecture}")
|
||||
print(f"OS: {manifest.operating_system}")
|
||||
```
|
||||
|
||||
### Update Manifest Properties
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ArtifactManifestProperties
|
||||
|
||||
client.update_manifest_properties(
|
||||
"my-image",
|
||||
"latest",
|
||||
properties=ArtifactManifestProperties(
|
||||
can_delete=False,
|
||||
can_write=False
|
||||
)
|
||||
)
|
||||
```
|
||||
|
||||
### Delete Manifest
|
||||
|
||||
```python
|
||||
# Delete by digest
|
||||
client.delete_manifest("my-image", "sha256:abc123...")
|
||||
|
||||
# Delete by tag
|
||||
manifest = client.get_manifest_properties("my-image", "old-tag")
|
||||
client.delete_manifest("my-image", manifest.digest)
|
||||
```
|
||||
|
||||
## Tag Operations
|
||||
|
||||
### Get Tag Properties
|
||||
|
||||
```python
|
||||
tag = client.get_tag_properties("my-image", "latest")
|
||||
print(f"Digest: {tag.digest}")
|
||||
print(f"Created: {tag.created_on}")
|
||||
```
|
||||
|
||||
### Delete Tag
|
||||
|
||||
```python
|
||||
client.delete_tag("my-image", "old-tag")
|
||||
```
|
||||
|
||||
## Upload and Download Artifacts
|
||||
|
||||
```python
|
||||
from azure.containerregistry import ContainerRegistryClient
|
||||
|
||||
client = ContainerRegistryClient(endpoint, DefaultAzureCredential())
|
||||
|
||||
# Download manifest
|
||||
manifest = client.download_manifest("my-image", "latest")
|
||||
print(f"Media type: {manifest.media_type}")
|
||||
print(f"Digest: {manifest.digest}")
|
||||
|
||||
# Download blob
|
||||
blob = client.download_blob("my-image", "sha256:abc123...")
|
||||
with open("layer.tar.gz", "wb") as f:
|
||||
for chunk in blob:
|
||||
f.write(chunk)
|
||||
```
|
||||
|
||||
## Async Client
|
||||
|
||||
```python
|
||||
from azure.containerregistry.aio import ContainerRegistryClient
|
||||
from azure.identity.aio import DefaultAzureCredential
|
||||
|
||||
async def list_repos():
|
||||
credential = DefaultAzureCredential()
|
||||
client = ContainerRegistryClient(endpoint, credential)
|
||||
|
||||
async for repo in client.list_repository_names():
|
||||
print(repo)
|
||||
|
||||
await client.close()
|
||||
await credential.close()
|
||||
```
|
||||
|
||||
## Clean Up Old Images
|
||||
|
||||
```python
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
cutoff = datetime.now(timezone.utc) - timedelta(days=30)
|
||||
|
||||
for manifest in client.list_manifest_properties("my-image"):
|
||||
if manifest.last_updated_on < cutoff and not manifest.tags:
|
||||
print(f"Deleting {manifest.digest}")
|
||||
client.delete_manifest("my-image", manifest.digest)
|
||||
```
|
||||
|
||||
## Client Operations
|
||||
|
||||
| Operation | Description |
|
||||
|-----------|-------------|
|
||||
| `list_repository_names` | List all repositories |
|
||||
| `get_repository_properties` | Get repository metadata |
|
||||
| `delete_repository` | Delete repository and all images |
|
||||
| `list_tag_properties` | List tags in repository |
|
||||
| `get_tag_properties` | Get tag metadata |
|
||||
| `delete_tag` | Delete specific tag |
|
||||
| `list_manifest_properties` | List manifests in repository |
|
||||
| `get_manifest_properties` | Get manifest metadata |
|
||||
| `delete_manifest` | Delete manifest by digest |
|
||||
| `download_manifest` | Download manifest content |
|
||||
| `download_blob` | Download layer blob |
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use Entra ID** for authentication in production
|
||||
2. **Delete by digest** not tag to avoid orphaned images
|
||||
3. **Lock production images** with can_delete=False
|
||||
4. **Clean up untagged manifests** regularly
|
||||
5. **Use async client** for high-throughput operations
|
||||
6. **Order by last_updated** to find recent/old images
|
||||
7. **Check manifest.tags** before deleting to avoid removing tagged images
|
||||
258
skills/official/microsoft/python/compute/fabric/SKILL.md
Normal file
258
skills/official/microsoft/python/compute/fabric/SKILL.md
Normal file
@@ -0,0 +1,258 @@
|
||||
---
|
||||
name: azure-mgmt-fabric-py
|
||||
description: |
|
||||
Azure Fabric Management SDK for Python. Use for managing Microsoft Fabric capacities and resources.
|
||||
Triggers: "azure-mgmt-fabric", "FabricMgmtClient", "Fabric capacity", "Microsoft Fabric", "Power BI capacity".
|
||||
---
|
||||
|
||||
# Azure Fabric Management SDK for Python
|
||||
|
||||
Manage Microsoft Fabric capacities and resources programmatically.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install azure-mgmt-fabric
|
||||
pip install azure-identity
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
|
||||
AZURE_RESOURCE_GROUP=<your-resource-group>
|
||||
```
|
||||
|
||||
## Authentication
|
||||
|
||||
```python
|
||||
from azure.identity import DefaultAzureCredential
|
||||
from azure.mgmt.fabric import FabricMgmtClient
|
||||
import os
|
||||
|
||||
credential = DefaultAzureCredential()
|
||||
client = FabricMgmtClient(
|
||||
credential=credential,
|
||||
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]
|
||||
)
|
||||
```
|
||||
|
||||
## Create Fabric Capacity
|
||||
|
||||
```python
|
||||
from azure.mgmt.fabric import FabricMgmtClient
|
||||
from azure.mgmt.fabric.models import FabricCapacity, FabricCapacityProperties, CapacitySku
|
||||
from azure.identity import DefaultAzureCredential
|
||||
import os
|
||||
|
||||
credential = DefaultAzureCredential()
|
||||
client = FabricMgmtClient(
|
||||
credential=credential,
|
||||
subscription_id=os.environ["AZURE_SUBSCRIPTION_ID"]
|
||||
)
|
||||
|
||||
resource_group = os.environ["AZURE_RESOURCE_GROUP"]
|
||||
capacity_name = "myfabriccapacity"
|
||||
|
||||
capacity = client.fabric_capacities.begin_create_or_update(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name,
|
||||
resource=FabricCapacity(
|
||||
location="eastus",
|
||||
sku=CapacitySku(
|
||||
name="F2", # Fabric SKU
|
||||
tier="Fabric"
|
||||
),
|
||||
properties=FabricCapacityProperties(
|
||||
administration=FabricCapacityAdministration(
|
||||
members=["user@contoso.com"]
|
||||
)
|
||||
)
|
||||
)
|
||||
).result()
|
||||
|
||||
print(f"Capacity created: {capacity.name}")
|
||||
```
|
||||
|
||||
## Get Capacity Details
|
||||
|
||||
```python
|
||||
capacity = client.fabric_capacities.get(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name
|
||||
)
|
||||
|
||||
print(f"Capacity: {capacity.name}")
|
||||
print(f"SKU: {capacity.sku.name}")
|
||||
print(f"State: {capacity.properties.state}")
|
||||
print(f"Location: {capacity.location}")
|
||||
```
|
||||
|
||||
## List Capacities in Resource Group
|
||||
|
||||
```python
|
||||
capacities = client.fabric_capacities.list_by_resource_group(
|
||||
resource_group_name=resource_group
|
||||
)
|
||||
|
||||
for capacity in capacities:
|
||||
print(f"Capacity: {capacity.name} - SKU: {capacity.sku.name}")
|
||||
```
|
||||
|
||||
## List All Capacities in Subscription
|
||||
|
||||
```python
|
||||
all_capacities = client.fabric_capacities.list_by_subscription()
|
||||
|
||||
for capacity in all_capacities:
|
||||
print(f"Capacity: {capacity.name} in {capacity.location}")
|
||||
```
|
||||
|
||||
## Update Capacity
|
||||
|
||||
```python
|
||||
from azure.mgmt.fabric.models import FabricCapacityUpdate, CapacitySku
|
||||
|
||||
updated = client.fabric_capacities.begin_update(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name,
|
||||
properties=FabricCapacityUpdate(
|
||||
sku=CapacitySku(
|
||||
name="F4", # Scale up
|
||||
tier="Fabric"
|
||||
),
|
||||
tags={"environment": "production"}
|
||||
)
|
||||
).result()
|
||||
|
||||
print(f"Updated SKU: {updated.sku.name}")
|
||||
```
|
||||
|
||||
## Suspend Capacity
|
||||
|
||||
Pause capacity to stop billing:
|
||||
|
||||
```python
|
||||
client.fabric_capacities.begin_suspend(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name
|
||||
).result()
|
||||
|
||||
print("Capacity suspended")
|
||||
```
|
||||
|
||||
## Resume Capacity
|
||||
|
||||
Resume a paused capacity:
|
||||
|
||||
```python
|
||||
client.fabric_capacities.begin_resume(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name
|
||||
).result()
|
||||
|
||||
print("Capacity resumed")
|
||||
```
|
||||
|
||||
## Delete Capacity
|
||||
|
||||
```python
|
||||
client.fabric_capacities.begin_delete(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name
|
||||
).result()
|
||||
|
||||
print("Capacity deleted")
|
||||
```
|
||||
|
||||
## Check Name Availability
|
||||
|
||||
```python
|
||||
from azure.mgmt.fabric.models import CheckNameAvailabilityRequest
|
||||
|
||||
result = client.fabric_capacities.check_name_availability(
|
||||
location="eastus",
|
||||
body=CheckNameAvailabilityRequest(
|
||||
name="my-new-capacity",
|
||||
type="Microsoft.Fabric/capacities"
|
||||
)
|
||||
)
|
||||
|
||||
if result.name_available:
|
||||
print("Name is available")
|
||||
else:
|
||||
print(f"Name not available: {result.reason}")
|
||||
```
|
||||
|
||||
## List Available SKUs
|
||||
|
||||
```python
|
||||
skus = client.fabric_capacities.list_skus(
|
||||
resource_group_name=resource_group,
|
||||
capacity_name=capacity_name
|
||||
)
|
||||
|
||||
for sku in skus:
|
||||
print(f"SKU: {sku.name} - Tier: {sku.tier}")
|
||||
```
|
||||
|
||||
## Client Operations
|
||||
|
||||
| Operation | Method |
|
||||
|-----------|--------|
|
||||
| `client.fabric_capacities` | Capacity CRUD operations |
|
||||
| `client.operations` | List available operations |
|
||||
|
||||
## Fabric SKUs
|
||||
|
||||
| SKU | Description | CUs |
|
||||
|-----|-------------|-----|
|
||||
| `F2` | Entry level | 2 Capacity Units |
|
||||
| `F4` | Small | 4 Capacity Units |
|
||||
| `F8` | Medium | 8 Capacity Units |
|
||||
| `F16` | Large | 16 Capacity Units |
|
||||
| `F32` | X-Large | 32 Capacity Units |
|
||||
| `F64` | 2X-Large | 64 Capacity Units |
|
||||
| `F128` | 4X-Large | 128 Capacity Units |
|
||||
| `F256` | 8X-Large | 256 Capacity Units |
|
||||
| `F512` | 16X-Large | 512 Capacity Units |
|
||||
| `F1024` | 32X-Large | 1024 Capacity Units |
|
||||
| `F2048` | 64X-Large | 2048 Capacity Units |
|
||||
|
||||
## Capacity States
|
||||
|
||||
| State | Description |
|
||||
|-------|-------------|
|
||||
| `Active` | Capacity is running |
|
||||
| `Paused` | Capacity is suspended (no billing) |
|
||||
| `Provisioning` | Being created |
|
||||
| `Updating` | Being modified |
|
||||
| `Deleting` | Being removed |
|
||||
| `Failed` | Operation failed |
|
||||
|
||||
## Long-Running Operations
|
||||
|
||||
All mutating operations are long-running (LRO). Use `.result()` to wait:
|
||||
|
||||
```python
|
||||
# Synchronous wait
|
||||
capacity = client.fabric_capacities.begin_create_or_update(...).result()
|
||||
|
||||
# Or poll manually
|
||||
poller = client.fabric_capacities.begin_create_or_update(...)
|
||||
while not poller.done():
|
||||
print(f"Status: {poller.status()}")
|
||||
time.sleep(5)
|
||||
capacity = poller.result()
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Use DefaultAzureCredential** for authentication
|
||||
2. **Suspend unused capacities** to reduce costs
|
||||
3. **Start with smaller SKUs** and scale up as needed
|
||||
4. **Use tags** for cost tracking and organization
|
||||
5. **Check name availability** before creating capacities
|
||||
6. **Handle LRO properly** — don't assume immediate completion
|
||||
7. **Set up capacity admins** — specify users who can manage workspaces
|
||||
8. **Monitor capacity usage** via Azure Monitor metrics
|
||||
Reference in New Issue
Block a user