Skip to content

Commit

Permalink
[Integration][Azure] Fix list subscription missing tags (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tankilevitch authored Nov 28, 2024
1 parent ecc9067 commit 412e336
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 111 deletions.
7 changes: 6 additions & 1 deletion integrations/azure/.port/resources/blueprints.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
"title": "Azure Subscription",
"icon": "Azure",
"schema": {
"properties": {},
"properties": {
"tags": {
"title": "Tags",
"type": "object"
}
},
"required": []
},
"mirrorProperties": {},
Expand Down
3 changes: 2 additions & 1 deletion integrations/azure/.port/resources/port-app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ resources:
identifier: .id
title: .display_name
blueprint: '"azureSubscription"'
properties: {}
properties:
tags: .tags
- kind: Microsoft.Resources/resourceGroups
selector:
query: 'true'
Expand Down
11 changes: 11 additions & 0 deletions integrations/azure/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
0.1.108 (2024-11-28)

### Improvements

- Bumped azure-mgmt-resource to `23.2.0` and aiohttp

### Bug Fixes

- Fixed the listing of azure subscription resource to use latest version of the SDK, this fixes the issue where some keys were not being returned in the response


0.1.107 (2024-11-25)

### Improvements
Expand Down
4 changes: 2 additions & 2 deletions integrations/azure/azure_integration/azure_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import azure.mgmt.resource.resources.v2022_09_01.aio.operations._operations
from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient
from azure.core.rest import HttpRequest
from azure.mgmt.resource.resources.v2022_09_01.operations._operations import ( # type: ignore
_format_url_section,
from azure.mgmt.resource.resources.v2022_09_01.operations._operations import (
_SERIALIZER,
)
from azure.mgmt.subscription._vendor import _format_url_section
from loguru import logger


Expand Down
6 changes: 5 additions & 1 deletion integrations/azure/azure_integration/ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from port_ocean.utils.async_iterators import stream_async_iterators_tasks
from azure.identity.aio import DefaultAzureCredential
from azure.core.exceptions import ResourceNotFoundError
from azure.mgmt.subscription.aio import SubscriptionClient
from azure.mgmt.resource.subscriptions.aio import SubscriptionClient

from azure_integration.utils import (
ResourceKindsWithSpecialHandling,
Expand Down Expand Up @@ -93,10 +93,14 @@ async def resync_subscriptions(kind: str) -> ASYNC_GENERATOR_RESYNC_TYPE:
"""
Re-syncs subscriptions, this is done separately because the subscriptions api is different from the other apis
"""
resource_selector = typing.cast(
AzureSpecificKindSelector, get_current_resource_config().selector
)
async with DefaultAzureCredential() as credential:
async with SubscriptionClient(credential=credential) as subscription_client:
async for subscriptions_batch in batch_resources_iterator(
subscription_client.subscriptions.list,
api_version=resource_selector.api_version,
):
yield subscriptions_batch

Expand Down
198 changes: 94 additions & 104 deletions integrations/azure/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions integrations/azure/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "azure"
version = "0.1.107"
version = "0.1.108"
description = "Azure integration"
authors = ["Tom Tankilevitch <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.12"
port_ocean = {version = "^0.14.3", extras = ["cli"]}
# due to patching the azure-mgmt-resource package, we need to use a specific version
azure-mgmt-resource = "23.0.1"
azure-mgmt-resource = "23.2.0"
azure-identity = "^1.13.0"
aiohttp = "^3.9.4"
cloudevents = "^1.9.0"
Expand Down

0 comments on commit 412e336

Please sign in to comment.