-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix resource creation in datadog #9144
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
Merged
kairu-ms
merged 5 commits into
Azure:main
from
shivansh257:users/agarwalshiv/Datadog/creationUpdateCLI
Sep 9, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
|
|
||
| Release History | ||
| =============== | ||
| 2.0.0 | ||
| ++++++ | ||
| * Fix resource creation issue | ||
|
|
||
| 1.0.0 | ||
| ++++++ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,16 +18,16 @@ class Create(AAZCommand): | |
| """Creates a new Datadog monitor resource in your Azure subscription. This sets up the integration between Azure and your Datadog account, enabling observability and monitoring of your Azure resources through Datadog. | ||
|
|
||
| :example: Monitors_Create | ||
| az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "payg_v2_Monthly" | ||
| az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --org-properties name="myResourceGroup" --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --sku name="payg_v3_Monthly" --identity type="SystemAssigned" --monitoring-status "Enabled" | ||
|
|
||
| :example: Monitors creation with linking to Datadog organization. | ||
| az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --datadog-organization-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "Linked" | ||
| az datadog monitor create --name "myMonitor-link" --resource-group "myResourceGroup" --location "West US 2" --org-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --identity type="SystemAssigned" --sku name="Linked" | ||
| """ | ||
|
|
||
| _aaz_info = { | ||
| "version": "2021-03-01", | ||
| "version": "2023-10-20", | ||
| "resources": [ | ||
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"], | ||
| ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], | ||
| ] | ||
| } | ||
|
|
||
|
|
@@ -99,8 +99,8 @@ def _build_arguments_schema(cls, *args, **kwargs): | |
| # define Arg Group "Properties" | ||
|
|
||
| _args_schema = cls._args_schema | ||
| _args_schema.datadog_organization_properties = AAZObjectArg( | ||
| options=["--datadog-organization-properties"], | ||
| _args_schema.org_properties = AAZObjectArg( | ||
| options=["--org-properties"], | ||
| arg_group="Properties", | ||
| help="Datadog organization properties", | ||
| ) | ||
|
|
@@ -117,28 +117,40 @@ def _build_arguments_schema(cls, *args, **kwargs): | |
| help="User info", | ||
| ) | ||
|
|
||
| datadog_organization_properties = cls._args_schema.datadog_organization_properties | ||
| datadog_organization_properties.api_key = AAZStrArg( | ||
| org_properties = cls._args_schema.org_properties | ||
| org_properties.api_key = AAZStrArg( | ||
| options=["api-key"], | ||
| help="Api key associated to the Datadog organization.", | ||
| ) | ||
| datadog_organization_properties.application_key = AAZStrArg( | ||
| org_properties.application_key = AAZStrArg( | ||
| options=["application-key"], | ||
| help="Application key associated to the Datadog organization.", | ||
| ) | ||
| datadog_organization_properties.enterprise_app_id = AAZStrArg( | ||
| org_properties.cspm = AAZBoolArg( | ||
| options=["cspm"], | ||
| help="The configuration which describes the state of cloud security posture management. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks.", | ||
| ) | ||
| org_properties.enterprise_app_id = AAZStrArg( | ||
| options=["enterprise-app-id"], | ||
| help="The Id of the Enterprise App used for Single sign on.", | ||
| ) | ||
| datadog_organization_properties.linking_auth_code = AAZStrArg( | ||
| org_properties.id = AAZStrArg( | ||
| options=["id"], | ||
| help="Id of the Datadog organization.", | ||
| ) | ||
| org_properties.linking_auth_code = AAZStrArg( | ||
| options=["linking-auth-code"], | ||
| help="The auth code used to linking to an existing datadog organization.", | ||
| ) | ||
| datadog_organization_properties.linking_client_id = AAZStrArg( | ||
| org_properties.linking_client_id = AAZStrArg( | ||
| options=["linking-client-id"], | ||
| help="The client_id from an existing in exchange for an auth token to link organization.", | ||
| ) | ||
| datadog_organization_properties.redirect_uri = AAZStrArg( | ||
| org_properties.name = AAZStrArg( | ||
| options=["name"], | ||
| help="Name of the Datadog organization.", | ||
| ) | ||
| org_properties.redirect_uri = AAZStrArg( | ||
| options=["redirect-uri"], | ||
| help="The redirect uri for linking.", | ||
| ) | ||
|
|
@@ -248,7 +260,7 @@ def url_parameters(self): | |
| def query_parameters(self): | ||
| parameters = { | ||
| **self.serialize_query_param( | ||
| "api-version", "2021-03-01", | ||
| "api-version", "2023-10-20", | ||
| required=True, | ||
| ), | ||
| } | ||
|
|
@@ -285,17 +297,20 @@ def content(self): | |
|
|
||
| properties = _builder.get(".properties") | ||
| if properties is not None: | ||
| properties.set_prop("datadogOrganizationProperties", AAZObjectType, ".datadog_organization_properties") | ||
| properties.set_prop("datadogOrganizationProperties", AAZObjectType, ".org_properties") | ||
| properties.set_prop("monitoringStatus", AAZStrType, ".monitoring_status") | ||
| properties.set_prop("userInfo", AAZObjectType, ".user_info", typ_kwargs={"flags": {"secret": True}}) | ||
|
|
||
| datadog_organization_properties = _builder.get(".properties.datadogOrganizationProperties") | ||
| if datadog_organization_properties is not None: | ||
| datadog_organization_properties.set_prop("apiKey", AAZStrType, ".api_key", typ_kwargs={"flags": {"secret": True}}) | ||
| datadog_organization_properties.set_prop("applicationKey", AAZStrType, ".application_key", typ_kwargs={"flags": {"secret": True}}) | ||
| datadog_organization_properties.set_prop("cspm", AAZBoolType, ".cspm") | ||
| datadog_organization_properties.set_prop("enterpriseAppId", AAZStrType, ".enterprise_app_id") | ||
| datadog_organization_properties.set_prop("id", AAZStrType, ".id") | ||
| datadog_organization_properties.set_prop("linkingAuthCode", AAZStrType, ".linking_auth_code", typ_kwargs={"flags": {"secret": True}}) | ||
| datadog_organization_properties.set_prop("linkingClientId", AAZStrType, ".linking_client_id", typ_kwargs={"flags": {"secret": True}}) | ||
| datadog_organization_properties.set_prop("name", AAZStrType, ".name") | ||
| datadog_organization_properties.set_prop("redirectUri", AAZStrType, ".redirect_uri") | ||
|
|
||
| user_info = _builder.get(".properties.userInfo") | ||
|
|
@@ -393,12 +408,9 @@ def _build_schema_on_200_201(cls): | |
| ) | ||
|
|
||
| datadog_organization_properties = cls._schema_on_200_201.properties.datadog_organization_properties | ||
| datadog_organization_properties.id = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| datadog_organization_properties.name = AAZStrType( | ||
| flags={"read_only": True}, | ||
| ) | ||
| datadog_organization_properties.cspm = AAZBoolType() | ||
| datadog_organization_properties.id = AAZStrType() | ||
| datadog_organization_properties.name = AAZStrType() | ||
|
|
||
| user_info = cls._schema_on_200_201.properties.user_info | ||
| user_info.email_address = AAZStrType( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The example uses
--org-properties name=\"myResourceGroup\"which sets the Datadog organization name to the same value as the resource group name. This may be confusing as it suggests the organization name should match the resource group, which is typically not the case. Consider using a more descriptive example likename=\"MyDatadogOrg\".