Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add DCv2 inventorySettings #51

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def main():
with open(f'Defender/{table}.json', 'w', encoding='utf-8') as f:
json.dump(data.json().get('results'), f, ensure_ascii=False, indent=4)

# DCv2 policies eg Settings Catalog
# DCv2 configurationSettings eg Settings Catalog
output = 'DCv2'
shutil.rmtree(output)
source = 'Settings'
Expand All @@ -135,6 +135,16 @@ async def main():
shutil.rmtree('settings')
shutil.copytree(Path(output, source), 'settings')

# DCv2 inventorySettings eg Properties catalog
source = 'Inventory'
os.makedirs(Path(output, source))
data = await client.device_management.with_url('https://graph.microsoft.com/beta/deviceManagement/inventorySettings').get(request_configuration=request_config)
for item in data.json().get('value'):
item.pop('version')
path = Path(output, source, item.get('id')).with_suffix('.json')
with open(path, 'w', encoding='utf-8') as f:
json.dump(item, f, ensure_ascii=False, indent=4)

source = 'Templates'
os.makedirs(Path(output, source))
data = await client.device_management.configuration_policy_templates.get(request_configuration=request_config)
Expand Down
Loading