Replies: 12 comments
-
@kapilt Any inputs on this issue ? |
Beta Was this translation helpful? Give feedback.
-
ping @cloud-custodian/azure |
Beta Was this translation helpful? Give feedback.
-
@cloud-custodian/azure , Any inputs on this issue ? |
Beta Was this translation helpful? Give feedback.
-
Looking into this now. |
Beta Was this translation helpful? Give feedback.
-
This was fixed 10/2020 in #6169 so it seems like you are not actually running 0.9.11? I'd verify the venv and version you are executing and potentially reinstall. Please let me know if you resolve it that way or if we need to investigate further. Update: |
Beta Was this translation helpful? Give feedback.
-
@stefangordon , Thanks for looking into it. I uninstalled and reinstalled the packages. Following is current version of azure package " c7n-azure 0.7.10 " . I don't get the error " object has no attribute 'function_app_name' " any more , but struck with the following now. Any inputs on this ??? I did found the required resource group and storage account is already present Error output : (custodian) xxxxx[/home/xxxxxx/custodian_azure/policies]$ custodian run --output-dir=. azure_vm_lifecycle.yml During handling of the above exception, another exception occurred: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
It is safe to run the deployment multiple times, it should detect what is missing and resolve it. I haven't seen this before but it looks to me like the storage queue creation took longer than it should resulting in the Event Grid configuration failing. I guess it will probably work if you try again. The storage queue is only created on the first deployment, and is then reused. The event grid configuration is updated each time. If it is not working after a retry then let me know what permissions you have on this subscription - it may be related. |
Beta Was this translation helpful? Give feedback.
-
@stefangordon , Sorry about the late reply. I was able to resolve the deployment error by reinstalling the modules and I'm able to deploy by using azure periodic method. Even though there is no error in deploying the policy , but still the function app failed to perform the necessary actions as given under the action section in policy. I've have provided the Owner, Virtual Machine Contributor, Storage Blob Data Contributor, Storage Queue Data Contributor roles to the user identity " Custodian-UD" . Below is the script and output after deploying , Kindly advise on this policies:
Output : 2021-06-30 22:02:04,382: custodian.azure.session:INFO Authenticated [Azure CLI | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
Beta Was this translation helpful? Give feedback.
-
@stefangordon Any updates on the below issue ? |
Beta Was this translation helpful? Give feedback.
-
So this policy will look for virtual machines with the 'custodiantest' tag, and if it finds one it will add another tag indicating this delayed To view the logs of the executions you can go to the "FunctionApp" then the individual "Function", then "Monitor". It will show recent executions, or you can go into the App Insights link as shown below: |
Beta Was this translation helpful? Give feedback.
-
@stefangordon , I get the below screen when I click the " Functions " under the " functionapp ". |
Beta Was this translation helpful? Give feedback.
-
@stefangordon , Any direction on this please ? |
Beta Was this translation helpful? Give feedback.
-
I'm getting the below error while deploying my first event based Azure policy
(custodian) xxxxxxxxxxxxxxxxxx[/home/xxxxxxxxx/custodian_azure/policies]$ custodian run --output-dir=. azure_vm_lifecycle.yml
2021-05-27 10:02:26,527: custodian.azure.session:INFO Authenticated [Principal | 99bb97bd-4e00-4d5d-aaa5-09c153e7bd0e]
2021-05-27 10:02:28,500: custodian.azure.deployment_unit.DeploymentUnit:INFO Function Application "azure-lifecycle-f95bceb3" not found.
2021-05-27 10:02:28,709: custodian.azure.deployment_unit.DeploymentUnit:INFO Found Application Service Plan "cloud-custodian".
2021-05-27 10:02:29,042: custodian.azure.deployment_unit.DeploymentUnit:INFO Found Application Insights "cloud-custodian".
2021-05-27 10:02:29,271: custodian.azure.deployment_unit.DeploymentUnit:INFO Found Storage Account "custodianf95bceb3".
2021-05-27 10:02:29,350: custodian.azure.deployment_unit.DeploymentUnit:INFO Creating Function Application "azure-lifecycle-f95bceb3"
2021-05-27 10:02:49,052: custodian.azure.deployment_unit.DeploymentUnit:INFO Function Application "azure-lifecycle-f95bceb3" successfully created
2021-05-27 10:02:49,053: custodian.commands:ERROR Error while executing policy azure_lifecycle, continuing
Traceback (most recent call last):
File "/home/xxxxxx/custodian_azure/custodian/lib64/python3.6/site-packages/c7n/commands.py", line 271, in run
policy()
File "/home/xxxxxxx/custodian_azure/custodian/lib64/python3.6/site-packages/c7n/policy.py", line 1182, in call
resources = mode.provision()
File "/home/xxxxxxx/custodian_azure/cloud-custodian/tools/c7n_azure/c7n_azure/policy.py", line 442, in provision
queue_name = re.sub(r'(-{2,})+', '-', self.function_params.function_app_name.lower())
AttributeError: 'FunctionAppInfrastructureParameters' object has no attribute 'function_app_name'
2021-05-27 10:02:49,053: custodian.commands:ERROR The following policies had errors while executing
Following is the policy that I'm deploying
policies:
- name: azure_lifecycle
resource: azure.vm
mode:
type: azure-event-grid
events:
- resourceProvider: Microsoft.Compute/virtualMachines
event: write
provision-options:
identity:
type: UserAssigned
id: custodian-ID
servicePlan:
name: cloud-custodian
filters:
- type: value
key: properties.storageProfile.osDisk.name
op: contains
value: not-null
- "tag:custodiantest": present
Debug output
(custodian) xxxxxxxxxxxxxxxxxx[/home/xxxxx/custodian_azure/policies]$ custodian version --debug
Please copy/paste the following info along with any bug reports:
Custodian: 0.9.11
Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Platform: posix.uname_result(sysname='Linux', nodename='xxxxxxxxxxxxxxxxxxxxxx', release='3.10.0-1160.25.1.el7.x86_64', version='#1 SMP Wed Apr 28 21:49:45 UTC 2021', machine='x86_64')
Using venv: True
Docker: False
Installed:
PyJWT==1.7.1
adal==1.2.4
applicationinsights==0.11.9
apscheduler==3.6.3
argcomplete==1.12.2
attrs==19.3.0
azure-cli-core==2.10.1
azure-cli-nspkg==3.0.4
azure-cli-telemetry==1.0.4
azure-common==1.1.25
azure-core==1.8.0
azure-cosmos==3.2.0
azure-cosmosdb-nspkg==2.0.2
azure-cosmosdb-table==1.0.6
azure-functions==1.3.0
azure-graphrbac==0.61.1
azure-keyvault==1.1.0
azure-mgmt-apimanagement==0.1.0
azure-mgmt-applicationinsights==0.2.0
azure-mgmt-authorization==0.60.0
azure-mgmt-batch==7.0.0
azure-mgmt-cdn==4.0.0
azure-mgmt-cognitiveservices==5.0.0
azure-mgmt-compute==10.0.0
azure-mgmt-containerinstance==1.5.0
azure-mgmt-containerregistry==2.8.0
azure-mgmt-containerservice==8.3.0
azure-mgmt-core==1.0.0
azure-mgmt-cosmosdb==0.11.0
azure-mgmt-costmanagement==0.1.0
azure-mgmt-databricks==0.1.0
azure-mgmt-datafactory==0.8.0
azure-mgmt-datalake-nspkg==3.0.1
azure-mgmt-datalake-store==0.5.0
azure-mgmt-dns==3.0.0
azure-mgmt-eventgrid==2.2.0
azure-mgmt-eventhub==3.1.0
azure-mgmt-hdinsight==1.7.0
azure-mgmt-iothub==0.10.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-logic==3.0.0
azure-mgmt-managementgroups==0.2.0
azure-mgmt-monitor==0.7.0
azure-mgmt-network==9.0.0
azure-mgmt-nspkg==3.0.2
azure-mgmt-policyinsights==0.4.0
azure-mgmt-rdbms==1.9.0
azure-mgmt-redis==6.0.0
azure-mgmt-resource==6.0.0
azure-mgmt-resourcegraph==2.0.0
azure-mgmt-search==2.1.0
azure-mgmt-sql==0.16.0
azure-mgmt-storage==7.2.0
azure-mgmt-subscription==0.5.0
azure-mgmt-web==0.44.0
azure-nspkg==3.0.2
azure-storage-blob==2.1.0
azure-storage-common==2.1.0
azure-storage-file==2.1.0
azure-storage-queue==2.1.0
bcrypt==3.2.0
boto3==1.17.33
botocore==1.20.33
c7n==0.9.11
certifi==2020.12.5
cffi==1.14.2
chardet==4.0.0
click==7.1.2
colorama==0.4.3
cryptography==3.0
distlib==0.3.1
docutils==0.15.2
humanfriendly==8.2
idna==2.10
importlib-metadata==1.7.0
importlib-resources==3.0.0
isodate==0.6.0
jmespath==0.10.0
jsonpickle==1.3
jsonschema==3.2.0
knack==0.7.2
msal==1.0.0
msal-extensions==0.1.3
msrest==0.6.18
msrestazure==0.6.4
netaddr==0.7.20
oauthlib==3.1.0
paramiko==2.7.1
pkginfo==1.5.0.1
portalocker==1.7.1
pycparser==2.20
pygments==2.6.1
pynacl==1.4.0
pyopenssl==19.1.0
pyrsistent==0.16.1
python-dateutil==2.8.1
pytz==2020.1
pyyaml==5.4.1
requests==2.25.1
requests-oauthlib==1.3.0
s3transfer==0.3.6
setuptools==57.0.0
six==1.15.0
tabulate==0.8.9
typing-extensions==3.7.4.3
tzlocal==2.1
urllib3==1.26.4
zipp==3.4.1
Beta Was this translation helpful? Give feedback.
All reactions